aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2021-10-24 16:40:16 +0200
committerSébastien Crozet <sebastien@crozet.re>2021-10-26 15:38:54 +0200
commitb45d4b5ac2b31856c15e802b31e288a58940cbf2 (patch)
treee6ed90504637749cb99229dc5d1d6abb02ce7b72 /src/geometry
parent601955b4ee4096db1f387017eb3d85ff727f6d31 (diff)
downloadrapier-b45d4b5ac2b31856c15e802b31e288a58940cbf2.tar.gz
rapier-b45d4b5ac2b31856c15e802b31e288a58940cbf2.tar.bz2
rapier-b45d4b5ac2b31856c15e802b31e288a58940cbf2.zip
Track the change of effective dominance of a rigid-body.
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/collider_components.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/geometry/collider_components.rs b/src/geometry/collider_components.rs
index 7d621f3..1c737dd 100644
--- a/src/geometry/collider_components.rs
+++ b/src/geometry/collider_components.rs
@@ -47,16 +47,21 @@ bitflags::bitflags! {
pub struct ColliderChanges: u32 {
/// Flag indicating that any component of the collider has been modified.
const MODIFIED = 1 << 0;
- /// Flag indicating that the `RigidBodyParent` component of the collider has been modified.
+ /// Flag indicating that the `ColliderParent` component of the collider has been modified.
const PARENT = 1 << 1; // => BF & NF updates.
- /// Flag indicating that the `RigidBodyPosition` component of the collider has been modified.
+ /// Flag indicating that the `ColliderPosition` component of the collider has been modified.
const POSITION = 1 << 2; // => BF & NF updates.
- /// Flag indicating that the `RigidBodyGroups` component of the collider has been modified.
+ /// Flag indicating that the collision groups of the collider have been modified.
const GROUPS = 1 << 3; // => NF update.
- /// Flag indicating that the `RigidBodyShape` component of the collider has been modified.
+ /// Flag indicating that the `ColliderShape` component of the collider has been modified.
const SHAPE = 1 << 4; // => BF & NF update. NF pair workspace invalidation.
- /// Flag indicating that the `RigidBodyType` component of the collider has been modified.
+ /// Flag indicating that the `ColliderType` component of the collider has been modified.
const TYPE = 1 << 5; // => NF update. NF pair invalidation.
+ /// Flag indicating that the dominance groups of the parent of this collider have been modified.
+ ///
+ /// This flags is automatically set by the `PhysicsPipeline` when the `RigidBodyChanges::DOMINANCE`
+ /// or `RigidBodyChanges::TYPE` of the parent rigid-body of this collider is detected.
+ const PARENT_EFFECTIVE_DOMINANCE = 1 << 6; // NF update.
}
}
@@ -76,6 +81,11 @@ impl ColliderChanges {
/// Do these changes justify a narrow-phase update?
pub fn needs_narrow_phase_update(self) -> bool {
+ // NOTE: for simplicity of implementation, we return `true` even if
+ // we only need a dominance update. If this does become a
+ // bottleneck at some point in the future (which is very unlikely)
+ // we could do a special-case for dominance-only change (so that
+ // we only update the relative_dominance of the pre-existing contact.
self.bits() > 1
}
}