aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-12-02 11:26:20 +0100
committerCrozet Sébastien <developer@crozet.re>2020-12-02 11:26:20 +0100
commitaada91966a02fbbbc5359cf74bb0401aac44ba8e (patch)
tree778a00eea7548d416043ad77539a1682116d377c /src
parentbde828cdaba10c3f18c1f23c2d70130b02b5176a (diff)
downloadrapier-aada91966a02fbbbc5359cf74bb0401aac44ba8e.tar.gz
rapier-aada91966a02fbbbc5359cf74bb0401aac44ba8e.tar.bz2
rapier-aada91966a02fbbbc5359cf74bb0401aac44ba8e.zip
Add a RigidBody::set_mass_properties method.
Diffstat (limited to 'src')
-rw-r--r--src/dynamics/rigid_body.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs
index 86a126f..5128b6f 100644
--- a/src/dynamics/rigid_body.rs
+++ b/src/dynamics/rigid_body.rs
@@ -142,6 +142,19 @@ impl RigidBody {
&self.mass_properties
}
+ /// Sets the rigid-body's mass properties.
+ ///
+ /// If `wake_up` is `true` then the rigid-body will be woken up if it was
+ /// put to sleep because it did not move for a while.
+ #[inline]
+ pub fn set_mass_properties(&mut self, props: MassProperties, wake_up: bool) {
+ if self.is_dynamic() && wake_up {
+ self.wake_up(true);
+ }
+
+ self.mass_properties = props;
+ }
+
/// The handles of colliders attached to this rigid body.
pub fn colliders(&self) -> &[ColliderHandle] {
&self.colliders[..]