diff options
| author | Sébastien Crozet <developer@crozet.re> | 2024-01-24 23:26:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-24 23:26:35 +0100 |
| commit | 7ba53df734128c45d3440366169d5f10bfa87183 (patch) | |
| tree | a33c7700e9319ed04a454ae760e6da78eabefa11 /src | |
| parent | d84aa82cf645cfc1ebf2a40e34d000b402bae47a (diff) | |
| parent | 1837d8f2b74c6db43925d3dc932f9a42f029b98f (diff) | |
| download | rapier-7ba53df734128c45d3440366169d5f10bfa87183.tar.gz rapier-7ba53df734128c45d3440366169d5f10bfa87183.tar.bz2 rapier-7ba53df734128c45d3440366169d5f10bfa87183.zip | |
Merge pull request #582 from dimforge/misc
Narrow-phase methods renames + some re-exports
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/island_manager.rs | 2 | ||||
| -rw-r--r-- | src/geometry/mod.rs | 5 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 26 | ||||
| -rw-r--r-- | src/pipeline/collision_pipeline.rs | 4 |
4 files changed, 25 insertions, 12 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/mod.rs b/src/geometry/mod.rs index a91c4b9..1525211 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -17,7 +17,9 @@ pub use self::narrow_phase::NarrowPhase; pub use self::collider::{Collider, ColliderBuilder}; pub use self::collider_set::ColliderSet; -pub use parry::query::TrackedContact; +pub use parry::bounding_volume::BoundingVolume; +pub use parry::query::{PointQuery, PointQueryWithLocation, RayCast, TrackedContact}; +pub use parry::shape::SharedShape; use crate::math::{Real, Vector}; @@ -53,7 +55,6 @@ pub type RayIntersection = parry::query::RayIntersection; pub type PointProjection = parry::query::PointProjection; /// The the time of impact between two shapes. pub type TOI = parry::query::TOI; -pub use parry::shape::SharedShape; bitflags::bitflags! { /// Flags providing more information regarding a collision event. 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)> + '_ { diff --git a/src/pipeline/collision_pipeline.rs b/src/pipeline/collision_pipeline.rs index b086fbe..796cc84 100644 --- a/src/pipeline/collision_pipeline.rs +++ b/src/pipeline/collision_pipeline.rs @@ -210,7 +210,7 @@ mod tests { let mut hit = false; - for (_, _, intersecting) in narrow_phase.intersections_with(a_handle) { + for (_, _, intersecting) in narrow_phase.intersection_pairs_with(a_handle) { if intersecting { hit = true; } @@ -262,7 +262,7 @@ mod tests { let mut hit = false; - for (_, _, intersecting) in narrow_phase.intersections_with(a_handle) { + for (_, _, intersecting) in narrow_phase.intersection_pairs_with(a_handle) { if intersecting { hit = true; } |
