Allow not overwriting entity visibility with debug renderer #470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.