aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/rigid_body.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-12-11 17:47:16 +0100
committerSébastien Crozet <developer@crozet.re>2022-12-11 17:47:42 +0100
commit0207f8cf96a3b091ca851276f98f3b482e2a39f2 (patch)
treeee0e602dc19a39b02e3b70e093815ca7bbb9f917 /src/dynamics/rigid_body.rs
parentcb9350fd802a6641597140c22e2a0ce4b2ebeb1f (diff)
downloadrapier-0207f8cf96a3b091ca851276f98f3b482e2a39f2.tar.gz
rapier-0207f8cf96a3b091ca851276f98f3b482e2a39f2.tar.bz2
rapier-0207f8cf96a3b091ca851276f98f3b482e2a39f2.zip
Properly take initial sleeping state set by the user when creating a rigid-body
Diffstat (limited to 'src/dynamics/rigid_body.rs')
-rw-r--r--src/dynamics/rigid_body.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs
index 26be983..bb1e9bf 100644
--- a/src/dynamics/rigid_body.rs
+++ b/src/dynamics/rigid_body.rs
@@ -135,7 +135,7 @@ impl RigidBody {
}
/// Sets the type of this rigid-body.
- pub fn set_body_type(&mut self, status: RigidBodyType) {
+ pub fn set_body_type(&mut self, status: RigidBodyType, wake_up: bool) {
if status != self.body_type {
self.changes.insert(RigidBodyChanges::TYPE);
self.body_type = status;
@@ -143,6 +143,10 @@ impl RigidBody {
if status == RigidBodyType::Fixed {
self.vels = RigidBodyVelocity::zero();
}
+
+ if self.is_dynamic() && wake_up {
+ self.wake_up(true);
+ }
}
}