aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-02-24 13:26:51 +0100
committerCrozet Sébastien <developer@crozet.re>2021-02-24 13:26:51 +0100
commit96ecb877e290ad15459258a415aca64ca4af3a69 (patch)
treeead6af02da8c021841dfe3f7ba5fa75e8339a12d /src/geometry
parent3cc2738e5fdcb0d25818b550cdff93eab75f1b20 (diff)
downloadrapier-96ecb877e290ad15459258a415aca64ca4af3a69.tar.gz
rapier-96ecb877e290ad15459258a415aca64ca4af3a69.tar.bz2
rapier-96ecb877e290ad15459258a415aca64ca4af3a69.zip
Implement dominance.
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/contact_pair.rs5
-rw-r--r--src/geometry/narrow_phase.rs2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs
index 50094ca..5ef1ac1 100644
--- a/src/geometry/contact_pair.rs
+++ b/src/geometry/contact_pair.rs
@@ -113,6 +113,8 @@ pub struct ContactManifoldData {
/// The contacts that will be seen by the constraints solver for computing forces.
#[cfg_attr(feature = "serde-serialize", serde(skip))]
pub solver_contacts: Vec<SolverContact>,
+ /// The relative dominance of the bodies involved in this contact manifold.
+ pub relative_dominance: i16,
/// A user-defined piece of data.
pub user_data: u32,
}
@@ -122,7 +124,7 @@ pub struct ContactManifoldData {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct SolverContact {
/// The index of the manifold contact used to generate this solver contact.
- pub contact_id: u8,
+ pub(crate) contact_id: u8,
/// The world-space contact point.
pub point: Point<Real>,
/// The distance between the two original contacts points along the contact normal.
@@ -177,6 +179,7 @@ impl ContactManifoldData {
solver_flags,
normal: Vector::zeros(),
solver_contacts: Vec::new(),
+ relative_dominance: 0,
user_data: 0,
}
}
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs
index d05b19a..28c53f1 100644
--- a/src/geometry/narrow_phase.rs
+++ b/src/geometry/narrow_phase.rs
@@ -555,6 +555,8 @@ impl NarrowPhase {
manifold.data.solver_contacts.clear();
manifold.data.body_pair = BodyPair::new(co1.parent(), co2.parent());
manifold.data.solver_flags = solver_flags;
+ manifold.data.relative_dominance =
+ rb1.effective_dominance_group() - rb2.effective_dominance_group();
manifold.data.normal = world_pos1 * manifold.local_n1;
// Generate solver contacts.