Currently PhysicsDebugPlugin always overwrites Visibility component of the entity with Collider. This is sometimes undesirable, as I want to have entities whose visibilty is part of the game logic.
Solution
This PR allows the debug renderer to instead not overwrite the visibilty when configured to do so. The PR also changes the default value to not overwrite, as it always forced colliders to be visibile before.
Alternatives
An Option<Visibility> could be used instead of an enum, but I hope this version is more readable. We could also just not change visibility if hide_meshes is set to false, but this would unexpectedly affect visibility if this is toggled.
Changelog
This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.
What changed as a result of this PR?
If applicable, organize changes under "Added", "Changed", or "Fixed" sub-headings
Stick to one or two sentences. If more detail is needed for a particular change, consider adding it to the "Solution" section
If you can't summarize the work, your change may be unreasonably large / unrelated. Consider splitting your PR to make it easier to review and merge!
Migration Guide
The hide_meshes: bool field of PhysicsGizmos (global) and DebugRender (entity) has been replaced with mesh_visibility: MeshVisibility. The old value false should be MeshVisibility::Overwrite(Visibility::Visible), and true should be MeshVisibility::Overwrite(Visibility::Hidden).
The debug renderer no longer forces entities with Collider to be visible by default To restore old behavior, we have to set the mesh_visibility field to one of the variants described above.
Objective
Currently
PhysicsDebugPlugin
always overwritesVisibility
component of the entity withCollider
. This is sometimes undesirable, as I want to have entities whose visibilty is part of the game logic.Solution
This PR allows the debug renderer to instead not overwrite the visibilty when configured to do so. The PR also changes the default value to not overwrite, as it always forced colliders to be visibile before.
Alternatives
An
Option<Visibility>
could be used instead of an enum, but I hope this version is more readable. We could also just not change visibility ifhide_meshes
is set tofalse
, but this would unexpectedly affect visibility if this is toggled.Changelog
Migration Guide
The
hide_meshes: bool
field ofPhysicsGizmos
(global) andDebugRender
(entity) has been replaced withmesh_visibility: MeshVisibility
. The old valuefalse
should beMeshVisibility::Overwrite(Visibility::Visible)
, andtrue
should beMeshVisibility::Overwrite(Visibility::Hidden)
.The debug renderer no longer forces entities with
Collider
to be visible by default To restore old behavior, we have to set themesh_visibility
field to one of the variants described above.