Restore contact events.

This commit is contained in:
Crozet Sébastien
2020-12-31 11:37:42 +01:00
parent 967145a949
commit 1feac2e02d
2 changed files with 24 additions and 16 deletions

View File

@@ -62,6 +62,7 @@ pub struct ContactPair {
///
/// All contact manifold contain themselves contact points between the colliders.
pub manifolds: Vec<ContactManifold>,
pub has_any_active_contact: bool,
pub(crate) workspace: Option<ContactManifoldsWorkspace>,
}
@@ -69,23 +70,11 @@ impl ContactPair {
pub(crate) fn new(pair: ColliderPair) -> Self {
Self {
pair,
has_any_active_contact: false,
manifolds: Vec::new(),
workspace: None,
}
}
/// Does this contact pair have any active contact?
///
/// An active contact is a contact that may result in a non-zero contact force.
pub fn has_any_active_contact(&self) -> bool {
for manifold in &self.manifolds {
if manifold.data.num_active_contacts() != 0 {
return true;
}
}
false
}
}
#[derive(Clone, Debug)]