Rename RigidBody::set_mass_properties -> set_additional_mass_properties
This commit is contained in:
@@ -305,20 +305,26 @@ impl RigidBody {
|
|||||||
self.ccd.ccd_active
|
self.ccd.ccd_active
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the rigid-body's initial mass properties.
|
/// Sets the rigid-body's additional mass properties.
|
||||||
///
|
///
|
||||||
/// If `wake_up` is `true` then the rigid-body will be woken up if it was
|
/// 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.
|
/// put to sleep because it did not move for a while.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_mass_properties(&mut self, props: MassProperties, wake_up: bool) {
|
pub fn set_additional_mass_properties(&mut self, props: MassProperties, wake_up: bool) {
|
||||||
if self.mprops.local_mprops != props {
|
if let Some(add_mprops) = &mut self.mprops.additional_local_mprops {
|
||||||
if self.is_dynamic() && wake_up {
|
self.mprops.local_mprops += props;
|
||||||
self.wake_up(true);
|
self.mprops.local_mprops -= **add_mprops;
|
||||||
}
|
**add_mprops = props;
|
||||||
|
} else {
|
||||||
self.mprops.local_mprops = props;
|
self.mprops.additional_local_mprops = Some(Box::new(props));
|
||||||
self.update_world_mass_properties();
|
self.mprops.local_mprops += props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.is_dynamic() && wake_up {
|
||||||
|
self.wake_up(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.update_world_mass_properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The handles of colliders attached to this rigid body.
|
/// The handles of colliders attached to this rigid body.
|
||||||
|
|||||||
Reference in New Issue
Block a user