aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2023-01-01 16:51:40 +0100
committerSébastien Crozet <developer@crozet.re>2023-01-01 16:51:40 +0100
commitc77ed7c9bf9f39149364df2c9dd9041a0a4cf6fa (patch)
treeb190394d7e05baf2a301715c12dd981b6dfef8a9
parent95cd7d5c9c73574cde1d07774b3d0969cda6833e (diff)
downloadrapier-c77ed7c9bf9f39149364df2c9dd9041a0a4cf6fa.tar.gz
rapier-c77ed7c9bf9f39149364df2c9dd9041a0a4cf6fa.tar.bz2
rapier-c77ed7c9bf9f39149364df2c9dd9041a0a4cf6fa.zip
Small coding style fix
-rw-r--r--src/dynamics/rigid_body.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs
index f9ea519..78132b2 100644
--- a/src/dynamics/rigid_body.rs
+++ b/src/dynamics/rigid_body.rs
@@ -940,19 +940,25 @@ impl RigidBody {
}
/// Retrieves the constant force(s) that the user has added to the body.
+ ///
+ /// Returns zero if the rigid-body isn’t dynamic.
pub fn user_force(&self) -> Vector<Real> {
if self.body_type == RigidBodyType::Dynamic {
- return self.forces.user_force;
+ self.forces.user_force
+ } else {
+ Vector::zeros()
}
- Vector::zeros()
}
/// Retrieves the constant torque(s) that the user has added to the body.
+ ///
+ /// Returns zero if the rigid-body isn’t dynamic.
pub fn user_torque(&self) -> AngVector<Real> {
if self.body_type == RigidBodyType::Dynamic {
- return self.forces.user_torque;
+ self.forces.user_torque
+ } else {
+ AngVector::zero()
}
- AngVector::zero()
}
}