aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-07-07 11:22:14 +0200
committerGitHub <noreply@github.com>2022-07-07 11:22:14 +0200
commit949573dd100ab2ae69402300794937f83daabeb1 (patch)
tree6313fdaad266efdfc329a7e0388373c7cd6ce041 /src/geometry
parent06ec9a0e76cea7a035b4335c591cd3fddd0d9999 (diff)
parentfade7682d4c3da35cd18104a903fc562a07b35b3 (diff)
downloadrapier-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/geometry')
-rw-r--r--src/geometry/collider.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs
index 7b0cc4c..a9af8d1 100644
--- a/src/geometry/collider.rs
+++ b/src/geometry/collider.rs
@@ -26,7 +26,7 @@ pub struct Collider {
pub(crate) material: ColliderMaterial,
pub(crate) flags: ColliderFlags,
pub(crate) bf_data: ColliderBroadPhaseData,
- pub(crate) contact_force_event_threshold: Real,
+ contact_force_event_threshold: Real,
/// User-defined data associated to this collider.
pub user_data: u128,
}
@@ -37,6 +37,18 @@ impl Collider {
self.changes = ColliderChanges::all();
}
+ pub(crate) fn effective_contact_force_event_threshold(&self) -> Real {
+ if self
+ .flags
+ .active_events
+ .contains(ActiveEvents::CONTACT_FORCE_EVENTS)
+ {
+ self.contact_force_event_threshold
+ } else {
+ Real::MAX
+ }
+ }
+
/// The rigid body this collider is attached to.
pub fn parent(&self) -> Option<RigidBodyHandle> {
self.parent.map(|parent| parent.handle)
@@ -412,7 +424,7 @@ impl ColliderBuilder {
active_collision_types: ActiveCollisionTypes::default(),
active_hooks: ActiveHooks::empty(),
active_events: ActiveEvents::empty(),
- contact_force_event_threshold: Real::MAX,
+ contact_force_event_threshold: 0.0,
}
}