Extract 2D debug collision drawing from CollisionShape2D to CollisionObject2D#59516
Extract 2D debug collision drawing from CollisionShape2D to CollisionObject2D#59516rburing wants to merge 1 commit intogodotengine:masterfrom
CollisionShape2D to CollisionObject2D#59516Conversation
|
Aren't server-created collision shapes usually used with server-created physics bodies? In that case they still wouldn't be drawn. The solution is simple enough to be ok, but the use-case is weird 🤔 |
|
Putting the drawing code somewhere deep so it can draw all the things would be even better, but this PR at least puts the 2D situation on par with 3D.
|
4fd5247 to
282856a
Compare
282856a to
a7e31c5
Compare
a7e31c5 to
a9d7648
Compare
CollisionShape2D to CollisionObject2DCollisionShape2D to CollisionObject2D
4cdb3ab to
96c27fb
Compare
|
The editor still has to draw each individual collision shape (even if it is not a child of a |
…Object2D This is more flexible, as it allows displaying shapes which were created directly in the physics server without a CollisionShape2D node. Also, it allows hiding disabled shapes completely (which was not possible before due to the coupling with the editor code). The code is inspired by the code of CollisionObject3D.
96c27fb to
096af18
Compare
This is more flexible, as it allows displaying collision shapes which were created directly in the physics server without a
CollisionShape2Dnode. In 3D theCollisionObject3Dalso handles the debug drawing.Fixes #36499.
Would appreciate testing to confirm that the shapes are still drawn in the right position in all cases.
Note: This change implies that the debug shape of a "lone"
CollisionShape2Dnode (not a child of any node derived fromCollisionObject2D) is no longer drawn. I consider this an improvement, as it is less confusing (there is already an in-editor configuration warning saying aCollisionShape2Dshould only be used as a child of a node derived fromCollisionObject2D). Moreover, this is the same behavior as it is currently in 3D.Note 2: This change also allows to hide disabled collision shapes completely, which was not possible before due to the coupling with the editor code. I've hidden the disabled collision shapes in this PR, but this decision is up for debate (whether they should always be hidden, always be shown greyed out as in the editor, or whether an option to toggle the behavior should be added). In 3D, disabled collision shapes are always hidden.