diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-07-07 11:22:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-07 11:22:14 +0200 |
| commit | 949573dd100ab2ae69402300794937f83daabeb1 (patch) | |
| tree | 6313fdaad266efdfc329a7e0388373c7cd6ce041 /src/pipeline | |
| parent | 06ec9a0e76cea7a035b4335c591cd3fddd0d9999 (diff) | |
| parent | fade7682d4c3da35cd18104a903fc562a07b35b3 (diff) | |
| download | rapier-949573dd100ab2ae69402300794937f83daabeb1.tar.gz rapier-949573dd100ab2ae69402300794937f83daabeb1.tar.bz2 rapier-949573dd100ab2ae69402300794937f83daabeb1.zip | |
Merge pull request #362 from dimforge/active-events-contact-force-event
Add ActiveEvents::CONTACT_FORCE_EVENTS for consistency with ActiveEvents::COLLISION_EVENTS
Diffstat (limited to 'src/pipeline')
| -rw-r--r-- | src/pipeline/event_handler.rs | 7 | ||||
| -rw-r--r-- | src/pipeline/physics_pipeline.rs | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/pipeline/event_handler.rs b/src/pipeline/event_handler.rs index e0f76a9..e5270ad 100644 --- a/src/pipeline/event_handler.rs +++ b/src/pipeline/event_handler.rs @@ -7,9 +7,12 @@ bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// Flags affecting the events generated for this collider. pub struct ActiveEvents: u32 { - /// If set, Rapier will call `EventHandler::handle_contact_event` + /// If set, Rapier will call `EventHandler::handle_collision_event` /// whenever relevant for this collider. const COLLISION_EVENTS = 0b0001; + /// If set, Rapier will call `EventHandler::handle_contact_force_event` + /// whenever relevant for this collider. + const CONTACT_FORCE_EVENTS = 0b0010; } } @@ -48,7 +51,7 @@ pub trait EventHandler: Send + Sync { /// /// A force event is generated whenever the total force magnitude applied between two /// colliders is `> Collider::contact_force_event_threshold` value of any of these - /// colliders. + /// colliders with the `ActiveEvents::CONTACT_FORCE_EVENTS` flag set. /// /// The "total force magnitude" here means "the sum of the magnitudes of the forces applied at /// all the contact points in a contact pair". Therefore, if the contact pair involves two diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 71ab578..391b39a 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -291,8 +291,8 @@ impl PhysicsPipeline { let co1 = &colliders[pair.collider1]; let co2 = &colliders[pair.collider2]; let threshold = co1 - .contact_force_event_threshold - .min(co2.contact_force_event_threshold); + .effective_contact_force_event_threshold() + .min(co2.effective_contact_force_event_threshold()); if threshold < Real::MAX { let total_magnitude = pair.total_impulse_magnitude() * inv_dt; |
