Fix shape modification not updating graphics in testbed (#708)

* Fix shape modification not updating graphics in testbed

* Add update collider to Testbed

* chore: lint shape_modifications3

* chore: simplify GraphicsManager::remove_collider_nodes

---------

Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
This commit is contained in:
Austin J. Garrett
2025-01-08 12:03:01 -05:00
committed by GitHub
parent 2ed1934756
commit 552cfebab0
3 changed files with 52 additions and 11 deletions

View File

@@ -492,13 +492,6 @@ impl TestbedGraphics<'_, '_, '_, '_, '_, '_> {
)
}
pub fn remove_collider(&mut self, handle: ColliderHandle, colliders: &ColliderSet) {
if let Some(parent_handle) = colliders.get(handle).map(|c| c.parent()) {
self.graphics
.remove_collider_nodes(&mut *self.commands, parent_handle, handle)
}
}
pub fn remove_body(&mut self, handle: RigidBodyHandle) {
self.graphics.remove_body_nodes(&mut *self.commands, handle)
}
@@ -513,6 +506,18 @@ impl TestbedGraphics<'_, '_, '_, '_, '_, '_> {
)
}
pub fn remove_collider(&mut self, handle: ColliderHandle, colliders: &ColliderSet) {
if let Some(parent_handle) = colliders.get(handle).map(|c| c.parent()) {
self.graphics
.remove_collider_nodes(&mut *self.commands, parent_handle, handle)
}
}
pub fn update_collider(&mut self, handle: ColliderHandle, colliders: &ColliderSet) {
self.remove_collider(handle, colliders);
self.add_collider(handle, colliders);
}
pub fn keys(&self) -> &ButtonInput<KeyCode> {
self.keys
}