diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-04-01 15:43:47 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2021-04-01 15:43:47 +0200 |
| commit | 2a21f47136933bb9e6170e02bfbbdb028914145a (patch) | |
| tree | 268ab42f7cd375da094c458cc5ed634b24a169aa /src | |
| parent | bd2dc781f366eda6e9c02bff9cd8ba39c5b6ba21 (diff) | |
| download | rapier-2a21f47136933bb9e6170e02bfbbdb028914145a.tar.gz rapier-2a21f47136933bb9e6170e02bfbbdb028914145a.tar.bz2 rapier-2a21f47136933bb9e6170e02bfbbdb028914145a.zip | |
Add getters indicating if the translation or rotation dofs of a rigid-body are locked.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 8176227..ba39873 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -203,6 +203,27 @@ impl RigidBody { } } + /// Are the translations of this rigid-body locked? + pub fn is_translation_locked(&self) -> bool { + self.flags.contains(RigidBodyFlags::TRANSLATION_LOCKED) + } + + /// Are the rotations of this rigid-body locked? + #[cfg(feature = "dim2")] + pub fn is_rotation_locked(&self) -> bool { + self.flags.contains(RigidBodyFlags::ROTATION_LOCKED_Z) + } + + /// Returns `true` for each rotational degrees of freedom locked on this rigid-body. + #[cfg(feature = "dim3")] + pub fn is_rotation_locked(&self) -> [bool; 3] { + [ + self.flags.contains(RigidBodyFlags::ROTATION_LOCKED_X), + self.flags.contains(RigidBodyFlags::ROTATION_LOCKED_Y), + self.flags.contains(RigidBodyFlags::ROTATION_LOCKED_Z), + ] + } + /// Enables of disable CCD (continuous collision-detection) for this rigid-body. pub fn enable_ccd(&mut self, enabled: bool) { self.flags.set(RigidBodyFlags::CCD_ENABLED, enabled) |
