diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-03-19 17:52:56 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2022-03-20 21:49:16 +0100 |
| commit | 063c638ec5906747e3ca85ee0c5f112c7775f797 (patch) | |
| tree | 498090f01c8cf8d69a35d03e123a1dfe006c54bf /src/geometry/narrow_phase.rs | |
| parent | a9e3441ecd64d50b478ab5370fabe187ec9a5c39 (diff) | |
| download | rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.gz rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.bz2 rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.zip | |
Combine contact events and intersection events into a single event type and flags
Diffstat (limited to 'src/geometry/narrow_phase.rs')
| -rw-r--r-- | src/geometry/narrow_phase.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index cf78b81..8a57ef4 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -8,9 +8,9 @@ use crate::dynamics::{ }; use crate::geometry::{ BroadPhasePairEvent, ColliderChanges, ColliderGraphIndex, ColliderHandle, ColliderMaterial, - ColliderPair, ColliderParent, ColliderPosition, ColliderShape, ColliderType, ContactData, - ContactEvent, ContactManifold, ContactManifoldData, ContactPair, InteractionGraph, - IntersectionEvent, SolverContact, SolverFlags, + ColliderPair, ColliderParent, ColliderPosition, ColliderShape, ColliderType, CollisionEvent, + ContactData, ContactManifold, ContactManifoldData, ContactPair, InteractionGraph, + SolverContact, SolverFlags, }; use crate::math::{Real, Vector}; use crate::pipeline::{ @@ -516,10 +516,10 @@ impl NarrowPhase { let co_flag2: &ColliderFlags = colliders.index(pair.collider2.0); if (co_flag1.active_events | co_flag2.active_events) - .contains(ActiveEvents::INTERSECTION_EVENTS) + .contains(ActiveEvents::COLLISION_EVENTS) { let prox_event = - IntersectionEvent::new(pair.collider1, pair.collider2, false); + CollisionEvent::Stopped(pair.collider1, pair.collider2); events.handle_intersection_event(prox_event) } } @@ -551,10 +551,10 @@ impl NarrowPhase { let co_flag2: &ColliderFlags = colliders.index(pair.collider2.0); if (co_flag1.active_events | co_flag2.active_events) - .contains(ActiveEvents::CONTACT_EVENTS) + .contains(ActiveEvents::COLLISION_EVENTS) { events.handle_contact_event( - ContactEvent::Stopped(pair.collider1, pair.collider2), + CollisionEvent::Stopped(pair.collider1, pair.collider2), &ctct, ) } @@ -795,10 +795,10 @@ impl NarrowPhase { let co_flags2: &ColliderFlags = colliders.index(handle2.0); let active_events = co_flags1.active_events | co_flags2.active_events; - if active_events.contains(ActiveEvents::INTERSECTION_EVENTS) + if active_events.contains(ActiveEvents::COLLISION_EVENTS) && had_intersection != edge.weight { - events.handle_intersection_event(IntersectionEvent::new( + events.handle_intersection_event(CollisionEvent::new( handle1, handle2, edge.weight, @@ -1027,15 +1027,15 @@ impl NarrowPhase { let active_events = co_flags1.active_events | co_flags2.active_events; if pair.has_any_active_contact != had_any_active_contact { - if active_events.contains(ActiveEvents::CONTACT_EVENTS) { + if active_events.contains(ActiveEvents::COLLISION_EVENTS) { if pair.has_any_active_contact { events.handle_contact_event( - ContactEvent::Started(pair.collider1, pair.collider2), + CollisionEvent::Started(pair.collider1, pair.collider2), pair, ); } else { events.handle_contact_event( - ContactEvent::Stopped(pair.collider1, pair.collider2), + CollisionEvent::Stopped(pair.collider1, pair.collider2), pair, ); } |
