Add a parameter to indicate if collider removal should wake-up its parent.

This commit is contained in:
Crozet Sébastien
2020-11-19 11:09:40 +01:00
parent 1b0f39073f
commit 0d49a80974
3 changed files with 14 additions and 3 deletions

View File

@@ -207,7 +207,7 @@ impl RigidBodySet {
* Remove colliders attached to this rigid-body.
*/
for collider in &rb.colliders {
colliders.remove(*collider, self);
colliders.remove(*collider, self, false);
}
/*

View File

@@ -78,10 +78,14 @@ impl ColliderSet {
}
/// Remove a collider from this set and update its parent accordingly.
///
/// If `wake_up` is `true`, the rigid-body the removed collider is attached to
/// will be woken up.
pub fn remove(
&mut self,
handle: ColliderHandle,
bodies: &mut RigidBodySet,
wake_up: bool,
) -> Option<Collider> {
let collider = self.colliders.remove(handle)?;
@@ -90,7 +94,10 @@ impl ColliderSet {
*/
if let Some(parent) = bodies.get_mut_internal(collider.parent) {
parent.remove_collider_internal(handle, &collider);
bodies.wake_up(collider.parent, true);
if wake_up {
bodies.wake_up(collider.parent, true);
}
}
/*