Skip to content

Commit 3a385ff

Browse files
eswartzJondolf
andauthored
Do not force all meshes visible on gizmo settings change. (#981)
# Objective - I have a scene with certain Mesh instances inside containers marked Visibility::Hidden, and a (now-fixed) issue where I was triggering a change to the `PhysicsGizmos` `GizmoConfigStore`. This was causing `change_mesh_visibility` to be called and modifying all the meshes to be visible. ## Solution - Switch to using `Visibility::Inherited` to respect parent (in)visibility, as `Visibility::Visible` affects everything, even in hidden hierarchies. - Since this code seems quite generic, I suppose the intent of may have been to intentionally expose all meshes for some reason, but that seems unlikely (debug rendering and the gizmos for colliders is "enough" IMO). ## Testing - Tested with my code that toggles `PhysicsGizmos` enablement. It no longer reveals shows invisible meshes. --------- Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
1 parent d797a29 commit 3a385ff

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

migration-guides/0.6-to-main.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,14 @@ simply ignore the new parameter with `_`.
1616

1717
Similar to many other plugins, the `SpatialQueryPlugin` now stores a schedule label,
1818
which by default is also passed via `PhysicsPlugins::new`.
19+
20+
## Physics Debug Gizmo Mesh Visibility
21+
22+
In past releases, `PhysicsGizmos::hide_meshes` forced all meshes to be visible when it is `false`.
23+
In **Avian 0.7**, it instead sets the mesh visibility to `Visibility::Inherited`, which is a more
24+
appropriate default.
25+
26+
This is still not perfect, as it does not fully respect the old visibility value. Doing so
27+
would require caching the old visibility in a separate component. This feature will likely
28+
undergo larger changes in the future, for example favoring `RenderLayers` over `Visibility`
29+
to create a dedicated "debug view".

src/debug_render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn change_mesh_visibility(
563563
if hide_mesh {
564564
*visibility = Visibility::Hidden;
565565
} else {
566-
*visibility = Visibility::Visible;
566+
*visibility = Visibility::Inherited;
567567
}
568568
}
569569
}

0 commit comments

Comments
 (0)