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

Allow CollisionObject3D to show collision shape meshes #45783

Merged

Conversation

trollodel
Copy link
Contributor

Right now, it is possible to create custom CollisionShape like nodes through the CollisionObject API.
The only limitation (that I found) is that shapes won't show in editor, and in game with "Visible Collision Shapes" active.

This PR addresses this limitation by allowing CollisionObject (only 3D for now) to show shapes directly.

Related to godotengine/godot-proposals#535.

image
In the left, a CapsuleShape3D added using CollisionShape3D. In the right, a BoxShape3D added using a script.

Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is very welcome! It also allows debug collision shapes to work with CollisionPolygon3D in game, since it creates a shape internally without using CollisionShape3D.

There's a bug with shapes update though. When I try to modify a shape when the game is running, I end up with both shapes being rendered (the old one and the updated one).
It's probably due to the things I commented in _update_debug_shapes.

Here's my test project:
test-physics-shapes-4.0.zip

editor/node_3d_editor_gizmos.cpp Outdated Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
@trollodel trollodel force-pushed the collisionobject3d-debug-shapes branch from cf454f8 to f6f3a86 Compare February 24, 2021 16:51
@trollodel trollodel requested a review from a team as a code owner February 24, 2021 16:51
@trollodel trollodel force-pushed the collisionobject3d-debug-shapes branch from f6f3a86 to a42a346 Compare February 24, 2021 16:52
scene/3d/collision_object_3d.cpp Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Show resolved Hide resolved
@trollodel trollodel force-pushed the collisionobject3d-debug-shapes branch from a42a346 to 6b03b85 Compare February 24, 2021 17:32
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
scene/3d/collision_object_3d.cpp Outdated Show resolved Hide resolved
Add an editor gizmo to CollisionObject3D.
CollisionShape3D no longer shows collision shapes directly.
@trollodel trollodel force-pushed the collisionobject3d-debug-shapes branch from 6b03b85 to 85a776d Compare February 24, 2021 17:50
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@akien-mga akien-mga merged commit 4cdd222 into godotengine:master Feb 24, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants