Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hack to draw shapes in 3D physics tests #615

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions 3d/physics_tests/test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,20 @@ func add_sphere(pos, radius, color):


func add_shape(shape, transform, color):
var body = StaticBody.new()
body.collision_layer = 0
body.collision_mask = 0
var debug_mesh = shape.get_debug_mesh()

var collision = CollisionShape.new()
collision.transform = transform
collision.shape = shape

body.add_child(collision)
var mesh_instance = MeshInstance.new()
mesh_instance.transform = transform
mesh_instance.mesh = debug_mesh

add_child(body)
_drawn_nodes.push_back(body)

call_deferred("initialize_shape_material", body, color)


func initialize_shape_material(body, color):
var mesh_instance = body.get_child(1)
var material = SpatialMaterial.new()
material.flags_unshaded = true
material.albedo_color = color
mesh_instance.material_override = material

add_child(mesh_instance)
_drawn_nodes.push_back(mesh_instance)


func clear_drawn_nodes():
for node in _drawn_nodes:
Expand Down