Properly take initial sleeping state set by the user when creating a rigid-body
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user