Add ActiveEvents::CONTACT_FORCE_EVENTS for consistency with ActiveEvents::COLLISION_EVENTS

This commit is contained in:
Sébastien Crozet
2022-07-07 10:58:10 +02:00
parent 06ec9a0e76
commit 73788a21ab
4 changed files with 21 additions and 6 deletions

View File

@@ -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,14 @@ 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 +420,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,
}
}