diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-07-08 14:08:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-08 14:08:04 +0200 |
| commit | 30f6dc47ec93e497f42d1c7363c75503e15b531c (patch) | |
| tree | 88af26693348b4dc680c9183e7a9ca5b4941b579 /src | |
| parent | 949573dd100ab2ae69402300794937f83daabeb1 (diff) | |
| parent | 72c2da55546e741489816f960b58fb6072f01730 (diff) | |
| download | rapier-30f6dc47ec93e497f42d1c7363c75503e15b531c.tar.gz rapier-30f6dc47ec93e497f42d1c7363c75503e15b531c.tar.bz2 rapier-30f6dc47ec93e497f42d1c7363c75503e15b531c.zip | |
Merge pull request #363 from dimforge/rename-restrict-rotations
Rename restrict_translation/rotation to set_allowed_translation/rotation
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index a44e335..b75035c 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,23 @@ 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 +229,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 +269,25 @@ 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 +1104,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 +1120,22 @@ 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 +1146,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 +1161,18 @@ impl RigidBodyBuilder { self } + /// Locks or unlocks rotations of this rigid-body along each cartesian axes. + #[deprecated(note = "Use `allowed_rotations` instead")] + #[cfg(feature = "dim3")] + 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 |
