From d82fc0d23d3d102345d4558fb2b693f52fd6ff3c Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Wed, 31 Mar 2021 12:00:55 +0200 Subject: Fix body status modification. --- src/dynamics/rigid_body.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/dynamics/rigid_body.rs') diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index ebf71de..47eea8a 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -182,10 +182,13 @@ impl RigidBody { self.body_status } - // pub fn set_body_status(&mut self, status: BodyStatus) { - // self.changes.insert(RigidBodyChanges::BODY_STATUS); - // self.body_status = status; - // } + /// Sets the status of this rigid-body. + pub fn set_body_status(&mut self, status: BodyStatus) { + if status != self.body_status { + self.changes.insert(RigidBodyChanges::BODY_STATUS); + self.body_status = status; + } + } /// The mass properties of this rigid-body. #[inline] @@ -948,7 +951,7 @@ impl RigidBodyBuilder { /// equal to the sum of this additional mass and the mass computed from the colliders /// (with non-zero densities) attached to this rigid-body. #[deprecated(note = "renamed to `additional_mass`.")] - pub fn mass(mut self, mass: Real) -> Self { + pub fn mass(self, mass: Real) -> Self { self.additional_mass(mass) } @@ -993,7 +996,7 @@ impl RigidBodyBuilder { /// Sets the principal angular inertia of this rigid-body. #[cfg(feature = "dim3")] #[deprecated(note = "renamed to `additional_principal_angular_inertia`.")] - pub fn principal_angular_inertia(mut self, inertia: AngVector) -> Self { + pub fn principal_angular_inertia(self, inertia: AngVector) -> Self { self.additional_principal_angular_inertia(inertia) } -- cgit