diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index bcce0805c..ce939013c 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -480,7 +480,7 @@ impl NarrowPhase { // Add the paid removed pair to the relevant graph. for pair in pairs_to_remove { - self.add_pair(colliders, &pair.0); + self.add_pair(islands.as_deref_mut(), colliders, bodies, &pair.0); } } @@ -556,7 +556,8 @@ impl NarrowPhase { } } - fn add_pair(&mut self, colliders: &ColliderSet, pair: &ColliderPair) { + fn add_pair(&mut self, islands: Option<&mut IslandManager>, colliders: &ColliderSet, bodies: &mut RigidBodySet, pair: &ColliderPair) + { if let (Some(co1), Some(co2)) = (colliders.get(pair.collider1), colliders.get(pair.collider2)) { @@ -630,6 +631,16 @@ impl NarrowPhase { ); } } + + if let Some(islands) = islands { + if let Some(co_parent1) = co1.parent { + islands.wake_up(bodies, co_parent1.handle, true); + } + + if let Some(co_parent2) = co2.parent { + islands.wake_up(bodies, co_parent2.handle, true); + } + } } } @@ -644,7 +655,7 @@ impl NarrowPhase { for event in broad_phase_events { match event { BroadPhasePairEvent::AddPair(pair) => { - self.add_pair(colliders, pair); + self.add_pair(islands.as_deref_mut(), colliders, bodies, pair); } BroadPhasePairEvent::DeletePair(pair) => { self.remove_pair(