aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-06-01 14:56:24 +0200
committerCrozet Sébastien <developer@crozet.re>2021-06-01 14:56:24 +0200
commitdbb3c8f43b151e48619ed954b20d44dd9e5c2c55 (patch)
tree30ef15379564436685f4367eee13e858e22185aa /src/geometry
parent5ef81cda406d796c5d188542b5bd9fbf4aefd4cf (diff)
downloadrapier-dbb3c8f43b151e48619ed954b20d44dd9e5c2c55.tar.gz
rapier-dbb3c8f43b151e48619ed954b20d44dd9e5c2c55.tar.bz2
rapier-dbb3c8f43b151e48619ed954b20d44dd9e5c2c55.zip
CCD: take collision groups into account
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/collider.rs1
-rw-r--r--src/geometry/collider_set.rs16
2 files changed, 11 insertions, 6 deletions
diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs
index 612df3c..b9007bf 100644
--- a/src/geometry/collider.rs
+++ b/src/geometry/collider.rs
@@ -33,7 +33,6 @@ pub struct Collider {
impl Collider {
pub(crate) fn reset_internal_references(&mut self) {
- self.co_parent = None;
self.co_bf_data.proxy_index = crate::INVALID_U32;
self.co_changes = ColliderChanges::all();
}
diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs
index d8603cd..dc0abdc 100644
--- a/src/geometry/collider_set.rs
+++ b/src/geometry/collider_set.rs
@@ -134,6 +134,7 @@ impl ColliderSet {
// Make sure the internal links are reset, they may not be
// if this rigid-body was obtained by cloning another one.
coll.reset_internal_references();
+ coll.co_parent = None;
let handle = ColliderHandle(self.colliders.insert(coll));
self.modified_colliders.push(handle);
handle
@@ -147,12 +148,17 @@ impl ColliderSet {
bodies: &mut RigidBodySet,
) -> ColliderHandle {
// Make sure the internal links are reset, they may not be
- // if this rigid-body was obtained by cloning another one.
+ // if this collider was obtained by cloning another one.
coll.reset_internal_references();
- coll.co_parent = Some(ColliderParent {
- handle: parent_handle,
- pos_wrt_parent: coll.co_pos.0,
- });
+
+ if let Some(prev_parent) = &mut coll.co_parent {
+ prev_parent.handle = parent_handle;
+ } else {
+ coll.co_parent = Some(ColliderParent {
+ handle: parent_handle,
+ pos_wrt_parent: coll.co_pos.0,
+ });
+ }
// NOTE: we use `get_mut` instead of `get_mut_internal` so that the
// modification flag is updated properly.