Make cloning rigid-bodies and colliders more idiomatic.

Fix #53
This commit is contained in:
Crozet Sébastien
2020-11-03 14:29:47 +01:00
parent 0cc850dc50
commit 036a246141
6 changed files with 29 additions and 38 deletions

View File

@@ -154,7 +154,11 @@ impl RigidBodySet {
}
/// Insert a rigid body into this set and retrieve its handle.
pub fn insert(&mut self, rb: RigidBody) -> RigidBodyHandle {
pub fn insert(&mut self, mut rb: RigidBody) -> RigidBodyHandle {
// Make sure the internal links are reset, they may not be
// if this rigid-body was obtained by cloning another one.
rb.reset_internal_links();
let handle = self.bodies.insert(rb);
let rb = &mut self.bodies[handle];