Initial commit for testing/fixing a deprecated godot-colyseus addon
This commit is contained in:
22
scripts/vector_line_3d.gd
Normal file
22
scripts/vector_line_3d.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends MeshInstance3D
|
||||
|
||||
@export var color: Color = Color(0.1, 0.8, 1.0, 0.9)
|
||||
|
||||
var _mesh: ImmediateMesh
|
||||
var _material: StandardMaterial3D
|
||||
|
||||
func _ready() -> void:
|
||||
_mesh = ImmediateMesh.new()
|
||||
mesh = _mesh
|
||||
_material = StandardMaterial3D.new()
|
||||
_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
|
||||
_material.albedo_color = color
|
||||
|
||||
func set_vector(end_point: Vector3) -> void:
|
||||
if _mesh == null:
|
||||
return
|
||||
_mesh.clear_surfaces()
|
||||
_mesh.surface_begin(Mesh.PRIMITIVE_LINES, _material)
|
||||
_mesh.surface_add_vertex(Vector3.ZERO)
|
||||
_mesh.surface_add_vertex(end_point)
|
||||
_mesh.surface_end()
|
||||
Reference in New Issue
Block a user