diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-24 22:51:30 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-24 22:51:30 +0100 |
| commit | 46b244167ce3a63331b2526689a3bc3d7faafde0 (patch) | |
| tree | 582ed7c1436e35048d1fa7472655093f0d94559e | |
| parent | 5bf398389449978ae168bf26be76726472253fb2 (diff) | |
| download | rapier-46b244167ce3a63331b2526689a3bc3d7faafde0.tar.gz rapier-46b244167ce3a63331b2526689a3bc3d7faafde0.tar.bz2 rapier-46b244167ce3a63331b2526689a3bc3d7faafde0.zip | |
feat!: rename narrow-phase methods for more clarity.
Renames `contacts_with` to`contact_pairs_with`; and `intersections_with` to `intersection_pairs_with`.
| -rw-r--r-- | src/dynamics/island_manager.rs | 2 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/dynamics/island_manager.rs b/src/dynamics/island_manager.rs index 43ac4ec..92b9a3e 100644 --- a/src/dynamics/island_manager.rs +++ b/src/dynamics/island_manager.rs @@ -203,7 +203,7 @@ impl IslandManager { stack: &mut Vec<RigidBodyHandle>, ) { for collider_handle in &rb_colliders.0 { - for inter in narrow_phase.contacts_with(*collider_handle) { + for inter in narrow_phase.contact_pairs_with(*collider_handle) { for manifold in &inter.manifolds { if !manifold.data.solver_contacts.is_empty() { let other = crate::utils::select_other( diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 8b5f0c9..4c3895a 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -109,7 +109,10 @@ impl NarrowPhase { /// /// It is strongly recommended to use the [`NarrowPhase::contacts_with`] method instead. This /// method can be used if the generation number of the collider handle isn't known. - pub fn contacts_with_unknown_gen(&self, collider: u32) -> impl Iterator<Item = &ContactPair> { + pub fn contact_pairs_with_unknown_gen( + &self, + collider: u32, + ) -> impl Iterator<Item = &ContactPair> { self.graph_indices .get_unknown_gen(collider) .map(|id| id.contact_graph_index) @@ -118,8 +121,12 @@ impl NarrowPhase { .map(|pair| pair.2) } - /// All the contacts involving the given collider. - pub fn contacts_with<'a>( + /// All the contact pairs involving the given collider. + /// + /// The returned contact pairs identify pairs of colliders with intersecting bounding-volumes. + /// To check if any geometric contact happened between the collider shapes, check + /// [`ContactPair::has_any_active_contact`]. + pub fn contact_pairs_with<'a>( &self, collider: ColliderHandle, ) -> impl Iterator<Item = &ContactPair> { @@ -131,11 +138,11 @@ impl NarrowPhase { .map(|pair| pair.2) } - /// All the intersections involving the given collider. + /// All the intersection pairs involving the given collider. /// /// It is strongly recommended to use the [`NarrowPhase::intersections_with`] method instead. /// This method can be used if the generation number of the collider handle isn't known. - pub fn intersections_with_unknown_gen( + pub fn intersection_pairs_with_unknown_gen( &self, collider: u32, ) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_ { @@ -150,8 +157,13 @@ impl NarrowPhase { }) } - /// All the intersections involving the given collider. - pub fn intersections_with( + /// All the intersection pairs involving the given collider, where at least one collider + /// involved in the intersection is a sensor. + /// + /// The returned contact pairs identify pairs of colliders (where at least one is a sensor) with + /// intersecting bounding-volumes. To check if any geometric overlap happened between the collider shapes, check + /// the returned boolean. + pub fn intersection_pairs_with( &self, collider: ColliderHandle, ) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_ { |
