aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics
diff options
context:
space:
mode:
Diffstat (limited to 'src/dynamics')
-rw-r--r--src/dynamics/joint/generic_joint.rs26
-rw-r--r--src/dynamics/rigid_body_components.rs6
2 files changed, 18 insertions, 14 deletions
diff --git a/src/dynamics/joint/generic_joint.rs b/src/dynamics/joint/generic_joint.rs
index 154c439..8d4066d 100644
--- a/src/dynamics/joint/generic_joint.rs
+++ b/src/dynamics/joint/generic_joint.rs
@@ -12,6 +12,7 @@ use crate::dynamics::SphericalJoint;
bitflags::bitflags! {
/// A bit mask identifying multiple degrees of freedom of a joint.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct JointAxesMask: u8 {
/// The linear (translational) degree of freedom along the local X axis of a joint.
const LIN_X = 1 << 0;
@@ -26,21 +27,21 @@ bitflags::bitflags! {
/// The angular degree of freedom along the local Z axis of a joint.
const ANG_Z = 1 << 5;
/// The set of degrees of freedom locked by a revolute joint.
- const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
/// The set of degrees of freedom locked by a prismatic joint.
- const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
/// The set of degrees of freedom locked by a fixed joint.
- const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_FIXED_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
/// The set of degrees of freedom locked by a spherical joint.
- const LOCKED_SPHERICAL_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits;
+ const LOCKED_SPHERICAL_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits();
/// The set of degrees of freedom left free by a revolute joint.
- const FREE_REVOLUTE_AXES = Self::ANG_X.bits;
+ const FREE_REVOLUTE_AXES = Self::ANG_X.bits();
/// The set of degrees of freedom left free by a prismatic joint.
- const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
+ const FREE_PRISMATIC_AXES = Self::LIN_X.bits();
/// The set of degrees of freedom left free by a fixed joint.
const FREE_FIXED_AXES = 0;
/// The set of degrees of freedom left free by a spherical joint.
- const FREE_SPHERICAL_AXES = Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const FREE_SPHERICAL_AXES = Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
/// The set of all translational degrees of freedom.
const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits();
/// The set of all angular degrees of freedom.
@@ -52,6 +53,7 @@ bitflags::bitflags! {
bitflags::bitflags! {
/// A bit mask identifying multiple degrees of freedom of a joint.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct JointAxesMask: u8 {
/// The linear (translational) degree of freedom along the local X axis of a joint.
const LIN_X = 1 << 0;
@@ -60,15 +62,15 @@ bitflags::bitflags! {
/// The angular degree of freedom of a joint.
const ANG_X = 1 << 2;
/// The set of degrees of freedom locked by a revolute joint.
- const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits;
+ const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits();
/// The set of degrees of freedom locked by a prismatic joint.
- const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::ANG_X.bits;
+ const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits() | Self::ANG_X.bits();
/// The set of degrees of freedom locked by a fixed joint.
- const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::ANG_X.bits;
+ const LOCKED_FIXED_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::ANG_X.bits();
/// The set of degrees of freedom left free by a revolute joint.
- const FREE_REVOLUTE_AXES = Self::ANG_X.bits;
+ const FREE_REVOLUTE_AXES = Self::ANG_X.bits();
/// The set of degrees of freedom left free by a prismatic joint.
- const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
+ const FREE_PRISMATIC_AXES = Self::LIN_X.bits();
/// The set of degrees of freedom left free by a fixed joint.
const FREE_FIXED_AXES = 0;
/// The set of all translational degrees of freedom.
diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs
index a391feb..641434c 100644
--- a/src/dynamics/rigid_body_components.rs
+++ b/src/dynamics/rigid_body_components.rs
@@ -96,6 +96,7 @@ impl RigidBodyType {
bitflags::bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
/// Flags describing how the rigid-body has been modified by the user.
pub struct RigidBodyChanges: u32 {
/// Flag indicating that any component of this rigid-body has been modified.
@@ -204,6 +205,7 @@ where
bitflags::bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
/// Flags affecting the behavior of the constraints solver for a given contact manifold.
// FIXME: rename this to LockedAxes
pub struct LockedAxes: u8 {
@@ -214,7 +216,7 @@ bitflags::bitflags! {
/// Flag indicating that the rigid-body cannot translate along the `Z` axis.
const TRANSLATION_LOCKED_Z = 1 << 2;
/// Flag indicating that the rigid-body cannot translate along any direction.
- const TRANSLATION_LOCKED = Self::TRANSLATION_LOCKED_X.bits | Self::TRANSLATION_LOCKED_Y.bits | Self::TRANSLATION_LOCKED_Z.bits;
+ const TRANSLATION_LOCKED = Self::TRANSLATION_LOCKED_X.bits() | Self::TRANSLATION_LOCKED_Y.bits() | Self::TRANSLATION_LOCKED_Z.bits();
/// Flag indicating that the rigid-body cannot rotate along the `X` axis.
const ROTATION_LOCKED_X = 1 << 3;
/// Flag indicating that the rigid-body cannot rotate along the `Y` axis.
@@ -222,7 +224,7 @@ bitflags::bitflags! {
/// Flag indicating that the rigid-body cannot rotate along the `Z` axis.
const ROTATION_LOCKED_Z = 1 << 5;
/// Combination of flags indicating that the rigid-body cannot rotate along any axis.
- const ROTATION_LOCKED = Self::ROTATION_LOCKED_X.bits | Self::ROTATION_LOCKED_Y.bits | Self::ROTATION_LOCKED_Z.bits;
+ const ROTATION_LOCKED = Self::ROTATION_LOCKED_X.bits() | Self::ROTATION_LOCKED_Y.bits() | Self::ROTATION_LOCKED_Z.bits();
}
}