aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-07-08 11:48:31 +0200
committerSébastien Crozet <developer@crozet.re>2022-07-08 11:48:31 +0200
commitefaf16aaea745a9b489a38f39bbe2db5fb85dcd1 (patch)
treed63ffc46534b0c640d87641788b9ba7ea9c94b09 /src/dynamics
parent949573dd100ab2ae69402300794937f83daabeb1 (diff)
downloadrapier-efaf16aaea745a9b489a38f39bbe2db5fb85dcd1.tar.gz
rapier-efaf16aaea745a9b489a38f39bbe2db5fb85dcd1.tar.bz2
rapier-efaf16aaea745a9b489a38f39bbe2db5fb85dcd1.zip
Rename restrict_translation/rotation to set_allowed_translation/rotation
Diffstat (limited to 'src/dynamics')
-rw-r--r--src/dynamics/rigid_body.rs65
1 files changed, 61 insertions, 4 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs
index a44e335..d64a88b 100644
--- a/src/dynamics/rigid_body.rs
+++ b/src/dynamics/rigid_body.rs
@@ -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