Rename restrict_translation/rotation to set_allowed_translation/rotation

This commit is contained in:
Sébastien Crozet
2022-07-08 11:48:31 +02:00
parent 949573dd10
commit efaf16aaea
3 changed files with 66 additions and 5 deletions

View File

@@ -167,7 +167,7 @@ impl RigidBody {
#[inline]
/// Locks or unlocks rotations of this rigid-body along each cartesian axes.
pub fn restrict_rotations(
pub fn set_allowed_rotations(
&mut self,
allow_rotations_x: bool,
allow_rotations_y: bool,
@@ -195,6 +195,18 @@ impl RigidBody {
}
}
/// Locks or unlocks rotations of this rigid-body along each cartesian axes.
#[deprecated(note = "Use `set_allowed_rotations` instead")]
pub fn restrict_rotations(
&mut self,
allow_rotations_x: bool,
allow_rotations_y: bool,
allow_rotations_z: bool,
wake_up: bool,
) {
self.set_allowed_rotations(allow_rotations_x, allow_rotations_y, allow_rotations_z, wake_up);
}
#[inline]
/// Locks or unlocks all the rotations of this rigid-body.
pub fn lock_translations(&mut self, locked: bool, wake_up: bool) {
@@ -212,7 +224,7 @@ impl RigidBody {
#[inline]
/// Locks or unlocks rotations of this rigid-body along each cartesian axes.
pub fn restrict_translations(
pub fn set_allowed_translations(
&mut self,
allow_translation_x: bool,
allow_translation_y: bool,
@@ -252,6 +264,24 @@ impl RigidBody {
self.update_world_mass_properties();
}
#[inline]
#[deprecated(note = "Use `set_allowed_translations` instead")]
/// Locks or unlocks rotations of this rigid-body along each cartesian axes.
pub fn restrict_translations(
&mut self,
allow_translation_x: bool,
allow_translation_y: bool,
#[cfg(feature = "dim3")] allow_translation_z: bool,
wake_up: bool,
) {
self.set_allowed_translations(
allow_translation_x,
allow_translation_y,
#[cfg(feature = "dim3")] allow_translation_z,
wake_up,
)
}
/// Are the translations of this rigid-body locked?
#[cfg(feature = "dim2")]
pub fn is_translation_locked(&self) -> bool {
@@ -1068,7 +1098,7 @@ impl RigidBodyBuilder {
}
/// Only allow translations of this rigid-body around specific coordinate axes.
pub fn restrict_translations(
pub fn allowed_translations(
mut self,
allow_translations_x: bool,
allow_translations_y: bool,
@@ -1084,6 +1114,21 @@ impl RigidBodyBuilder {
self
}
#[deprecated(note = "Use `allowed_translations` instead")]
/// Only allow translations of this rigid-body around specific coordinate axes.
pub fn restrict_translations(
self,
allow_translations_x: bool,
allow_translations_y: bool,
#[cfg(feature = "dim3")] allow_translations_z: bool,
) -> Self {
self.allowed_translations(
allow_translations_x,
allow_translations_y,
#[cfg(feature = "dim3")] allow_translations_z,
)
}
/// Prevents this rigid-body from rotating because of forces.
pub fn lock_rotations(mut self) -> Self {
self.mprops_flags.set(LockedAxes::ROTATION_LOCKED_X, true);
@@ -1094,7 +1139,7 @@ impl RigidBodyBuilder {
/// Only allow rotations of this rigid-body around specific coordinate axes.
#[cfg(feature = "dim3")]
pub fn restrict_rotations(
pub fn allowed_rotations(
mut self,
allow_rotations_x: bool,
allow_rotations_y: bool,
@@ -1109,6 +1154,18 @@ impl RigidBodyBuilder {
self
}
/// Locks or unlocks rotations of this rigid-body along each cartesian axes.
#[deprecated(note = "Use `allowed_rotations` instead")]
pub fn restrict_rotations(
self,
allow_rotations_x: bool,
allow_rotations_y: bool,
allow_rotations_z: bool,
) -> Self {
self.allowed_rotations(allow_rotations_x, allow_rotations_y, allow_rotations_z)
}
/// Sets the damping factor for the linear part of the rigid-body motion.
///
/// The higher the linear damping factor is, the more quickly the rigid-body