Skip to content

Commit 46b2441

Browse files
committed
feat!: rename narrow-phase methods for more clarity.
Renames `contacts_with` to`contact_pairs_with`; and `intersections_with` to `intersection_pairs_with`.
1 parent 5bf3983 commit 46b2441

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/dynamics/island_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl IslandManager {
203203
stack: &mut Vec<RigidBodyHandle>,
204204
) {
205205
for collider_handle in &rb_colliders.0 {
206-
for inter in narrow_phase.contacts_with(*collider_handle) {
206+
for inter in narrow_phase.contact_pairs_with(*collider_handle) {
207207
for manifold in &inter.manifolds {
208208
if !manifold.data.solver_contacts.is_empty() {
209209
let other = crate::utils::select_other(

src/geometry/narrow_phase.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ impl NarrowPhase {
109109
///
110110
/// It is strongly recommended to use the [`NarrowPhase::contacts_with`] method instead. This
111111
/// method can be used if the generation number of the collider handle isn't known.
112-
pub fn contacts_with_unknown_gen(&self, collider: u32) -> impl Iterator<Item = &ContactPair> {
112+
pub fn contact_pairs_with_unknown_gen(
113+
&self,
114+
collider: u32,
115+
) -> impl Iterator<Item = &ContactPair> {
113116
self.graph_indices
114117
.get_unknown_gen(collider)
115118
.map(|id| id.contact_graph_index)
@@ -118,8 +121,12 @@ impl NarrowPhase {
118121
.map(|pair| pair.2)
119122
}
120123

121-
/// All the contacts involving the given collider.
122-
pub fn contacts_with<'a>(
124+
/// All the contact pairs involving the given collider.
125+
///
126+
/// The returned contact pairs identify pairs of colliders with intersecting bounding-volumes.
127+
/// To check if any geometric contact happened between the collider shapes, check
128+
/// [`ContactPair::has_any_active_contact`].
129+
pub fn contact_pairs_with<'a>(
123130
&self,
124131
collider: ColliderHandle,
125132
) -> impl Iterator<Item = &ContactPair> {
@@ -131,11 +138,11 @@ impl NarrowPhase {
131138
.map(|pair| pair.2)
132139
}
133140

134-
/// All the intersections involving the given collider.
141+
/// All the intersection pairs involving the given collider.
135142
///
136143
/// It is strongly recommended to use the [`NarrowPhase::intersections_with`] method instead.
137144
/// This method can be used if the generation number of the collider handle isn't known.
138-
pub fn intersections_with_unknown_gen(
145+
pub fn intersection_pairs_with_unknown_gen(
139146
&self,
140147
collider: u32,
141148
) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_ {
@@ -150,8 +157,13 @@ impl NarrowPhase {
150157
})
151158
}
152159

153-
/// All the intersections involving the given collider.
154-
pub fn intersections_with(
160+
/// All the intersection pairs involving the given collider, where at least one collider
161+
/// involved in the intersection is a sensor.
162+
///
163+
/// The returned contact pairs identify pairs of colliders (where at least one is a sensor) with
164+
/// intersecting bounding-volumes. To check if any geometric overlap happened between the collider shapes, check
165+
/// the returned boolean.
166+
pub fn intersection_pairs_with(
155167
&self,
156168
collider: ColliderHandle,
157169
) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_ {

0 commit comments

Comments
 (0)