CCD: take collision groups into account

This commit is contained in:
Crozet Sébastien
2021-06-01 14:56:24 +02:00
parent 5ef81cda40
commit dbb3c8f43b
6 changed files with 107 additions and 48 deletions

View File

@@ -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.