@@ -46,29 +46,20 @@ func add_sphere(pos, radius, color):
4646
4747
4848func add_shape (shape , transform , color ):
49- var body = StaticBody .new ()
50- body .collision_layer = 0
51- body .collision_mask = 0
49+ var debug_mesh = shape .get_debug_mesh ()
5250
53- var collision = CollisionShape .new ()
54- collision .transform = transform
55- collision .shape = shape
56-
57- body .add_child (collision )
51+ var mesh_instance = MeshInstance .new ()
52+ mesh_instance .transform = transform
53+ mesh_instance .mesh = debug_mesh
5854
59- add_child (body )
60- _drawn_nodes .push_back (body )
61-
62- call_deferred ("initialize_shape_material" , body , color )
63-
64-
65- func initialize_shape_material (body , color ):
66- var mesh_instance = body .get_child (1 )
6755 var material = SpatialMaterial .new ()
6856 material .flags_unshaded = true
6957 material .albedo_color = color
7058 mesh_instance .material_override = material
7159
60+ add_child (mesh_instance )
61+ _drawn_nodes .push_back (mesh_instance )
62+
7263
7364func clear_drawn_nodes ():
7465 for node in _drawn_nodes :
0 commit comments