diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-03-31 12:00:55 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2021-03-31 12:09:09 +0200 |
| commit | d82fc0d23d3d102345d4558fb2b693f52fd6ff3c (patch) | |
| tree | ce55132025a781ffb0eb4ecfb8ff4bbe679b6fe3 /src/dynamics/rigid_body.rs | |
| parent | 1187ef796d482b883e9a07f2609798db2a71a09d (diff) | |
| download | rapier-d82fc0d23d3d102345d4558fb2b693f52fd6ff3c.tar.gz rapier-d82fc0d23d3d102345d4558fb2b693f52fd6ff3c.tar.bz2 rapier-d82fc0d23d3d102345d4558fb2b693f52fd6ff3c.zip | |
Fix body status modification.
Diffstat (limited to 'src/dynamics/rigid_body.rs')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 15 |
1 files changed, 9 insertions, 6 deletions
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<Real>) -> Self { + pub fn principal_angular_inertia(self, inertia: AngVector<Real>) -> Self { self.additional_principal_angular_inertia(inertia) } |
