feat: rename JointAxesMask::X/Y/Z by ::LIN_X/LIN_Y/LIN_Z and JointAxis::X/Y/Z by ::LinX/LinY/LinZ
This commit is contained in:
committed by
Sébastien Crozet
parent
5c44d936f7
commit
c785ea4996
@@ -18,9 +18,9 @@ fn create_coupled_joints(
|
|||||||
colliders.insert_with_parent(ColliderBuilder::cuboid(1.0, 1.0, 1.0), body1, bodies);
|
colliders.insert_with_parent(ColliderBuilder::cuboid(1.0, 1.0, 1.0), body1, bodies);
|
||||||
|
|
||||||
let joint1 = GenericJointBuilder::new(JointAxesMask::empty())
|
let joint1 = GenericJointBuilder::new(JointAxesMask::empty())
|
||||||
.limits(JointAxis::X, [-3.0, 3.0])
|
.limits(JointAxis::LinX, [-3.0, 3.0])
|
||||||
.limits(JointAxis::Y, [0.0, 3.0])
|
.limits(JointAxis::LinY, [0.0, 3.0])
|
||||||
.coupled_axes(JointAxesMask::Y | JointAxesMask::Z);
|
.coupled_axes(JointAxesMask::LIN_Y | JointAxesMask::LIN_Z);
|
||||||
|
|
||||||
if use_articulations {
|
if use_articulations {
|
||||||
multibody_joints.insert(ground, body1, joint1, true);
|
multibody_joints.insert(ground, body1, joint1, true);
|
||||||
@@ -416,13 +416,13 @@ fn create_spherical_joints_with_limits(
|
|||||||
|
|
||||||
let joint1 = SphericalJointBuilder::new()
|
let joint1 = SphericalJointBuilder::new()
|
||||||
.local_anchor2(Point::from(-shift))
|
.local_anchor2(Point::from(-shift))
|
||||||
.limits(JointAxis::X, [-0.2, 0.2])
|
.limits(JointAxis::LinX, [-0.2, 0.2])
|
||||||
.limits(JointAxis::Y, [-0.2, 0.2]);
|
.limits(JointAxis::LinY, [-0.2, 0.2]);
|
||||||
|
|
||||||
let joint2 = SphericalJointBuilder::new()
|
let joint2 = SphericalJointBuilder::new()
|
||||||
.local_anchor2(Point::from(-shift))
|
.local_anchor2(Point::from(-shift))
|
||||||
.limits(JointAxis::X, [-0.3, 0.3])
|
.limits(JointAxis::LinX, [-0.3, 0.3])
|
||||||
.limits(JointAxis::Y, [-0.3, 0.3]);
|
.limits(JointAxis::LinY, [-0.3, 0.3]);
|
||||||
|
|
||||||
if use_articulations {
|
if use_articulations {
|
||||||
multibody_joints.insert(ground, ball1, joint1, true);
|
multibody_joints.insert(ground, ball1, joint1, true);
|
||||||
|
|||||||
@@ -96,15 +96,17 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
wheel_pos_in_car_space - body_position_in_car_space;
|
wheel_pos_in_car_space - body_position_in_car_space;
|
||||||
|
|
||||||
// Suspension between the body and the axle.
|
// Suspension between the body and the axle.
|
||||||
let mut locked_axes =
|
let mut locked_axes = JointAxesMask::LIN_X
|
||||||
JointAxesMask::X | JointAxesMask::Z | JointAxesMask::ANG_X | JointAxesMask::ANG_Z;
|
| JointAxesMask::LIN_Z
|
||||||
|
| JointAxesMask::ANG_X
|
||||||
|
| JointAxesMask::ANG_Z;
|
||||||
if !is_front {
|
if !is_front {
|
||||||
locked_axes |= JointAxesMask::ANG_Y;
|
locked_axes |= JointAxesMask::ANG_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut suspension_joint = GenericJointBuilder::new(locked_axes)
|
let mut suspension_joint = GenericJointBuilder::new(locked_axes)
|
||||||
.limits(JointAxis::Y, [0.0, suspension_height])
|
.limits(JointAxis::LinY, [0.0, suspension_height])
|
||||||
.motor_position(JointAxis::Y, 0.0, 1.0e4, 1.0e3)
|
.motor_position(JointAxis::LinY, 0.0, 1.0e4, 1.0e3)
|
||||||
.local_anchor1(suspension_attachment_in_body_space.into());
|
.local_anchor1(suspension_attachment_in_body_space.into());
|
||||||
|
|
||||||
if is_front {
|
if is_front {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ bitflags::bitflags! {
|
|||||||
/// A bit mask identifying multiple degrees of freedom of a joint.
|
/// A bit mask identifying multiple degrees of freedom of a joint.
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
pub struct JointAxesMask: u8 {
|
pub struct JointAxesMask: u8 {
|
||||||
/// The translational degree of freedom along the local X axis of a joint.
|
/// The linear (translational) degree of freedom along the local X axis of a joint.
|
||||||
const X = 1 << 0;
|
const LIN_X = 1 << 0;
|
||||||
/// The translational degree of freedom along the local Y axis of a joint.
|
/// The linear (translational) degree of freedom along the local Y axis of a joint.
|
||||||
const Y = 1 << 1;
|
const LIN_Y = 1 << 1;
|
||||||
/// The translational degree of freedom along the local Z axis of a joint.
|
/// The linear (translational) degree of freedom along the local Z axis of a joint.
|
||||||
const Z = 1 << 2;
|
const LIN_Z = 1 << 2;
|
||||||
/// The angular degree of freedom along the local X axis of a joint.
|
/// The angular degree of freedom along the local X axis of a joint.
|
||||||
const ANG_X = 1 << 3;
|
const ANG_X = 1 << 3;
|
||||||
/// The angular degree of freedom along the local Y axis of a joint.
|
/// The angular degree of freedom along the local Y axis of a joint.
|
||||||
@@ -26,23 +26,23 @@ bitflags::bitflags! {
|
|||||||
/// The angular degree of freedom along the local Z axis of a joint.
|
/// The angular degree of freedom along the local Z axis of a joint.
|
||||||
const ANG_Z = 1 << 5;
|
const ANG_Z = 1 << 5;
|
||||||
/// The set of degrees of freedom locked by a revolute joint.
|
/// The set of degrees of freedom locked by a revolute joint.
|
||||||
const LOCKED_REVOLUTE_AXES = Self::X.bits | Self::Y.bits | Self::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.
|
/// The set of degrees of freedom locked by a prismatic joint.
|
||||||
const LOCKED_PRISMATIC_AXES = Self::Y.bits | Self::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.
|
/// The set of degrees of freedom locked by a fixed joint.
|
||||||
const LOCKED_FIXED_AXES = Self::X.bits | Self::Y.bits | Self::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.
|
/// The set of degrees of freedom locked by a spherical joint.
|
||||||
const LOCKED_SPHERICAL_AXES = Self::X.bits | Self::Y.bits | Self::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.
|
/// 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.
|
/// The set of degrees of freedom left free by a prismatic joint.
|
||||||
const FREE_PRISMATIC_AXES = Self::X.bits;
|
const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
|
||||||
/// The set of degrees of freedom left free by a fixed joint.
|
/// The set of degrees of freedom left free by a fixed joint.
|
||||||
const FREE_FIXED_AXES = 0;
|
const FREE_FIXED_AXES = 0;
|
||||||
/// The set of degrees of freedom left free by a spherical joint.
|
/// 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.
|
/// The set of all translational degrees of freedom.
|
||||||
const LIN_AXES = Self::X.bits() | Self::Y.bits() | Self::Z.bits();
|
const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits();
|
||||||
/// The set of all angular degrees of freedom.
|
/// The set of all angular degrees of freedom.
|
||||||
const ANG_AXES = Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
|
const ANG_AXES = Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
|
||||||
}
|
}
|
||||||
@@ -53,26 +53,26 @@ bitflags::bitflags! {
|
|||||||
/// A bit mask identifying multiple degrees of freedom of a joint.
|
/// A bit mask identifying multiple degrees of freedom of a joint.
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
pub struct JointAxesMask: u8 {
|
pub struct JointAxesMask: u8 {
|
||||||
/// The translational degree of freedom along the local X axis of a joint.
|
/// The linear (translational) degree of freedom along the local X axis of a joint.
|
||||||
const X = 1 << 0;
|
const LIN_X = 1 << 0;
|
||||||
/// The translational degree of freedom along the local Y axis of a joint.
|
/// The linear (translational) degree of freedom along the local Y axis of a joint.
|
||||||
const Y = 1 << 1;
|
const LIN_Y = 1 << 1;
|
||||||
/// The angular degree of freedom of a joint.
|
/// The angular degree of freedom of a joint.
|
||||||
const ANG_X = 1 << 2;
|
const ANG_X = 1 << 2;
|
||||||
/// The set of degrees of freedom locked by a revolute joint.
|
/// The set of degrees of freedom locked by a revolute joint.
|
||||||
const LOCKED_REVOLUTE_AXES = Self::X.bits | Self::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.
|
/// The set of degrees of freedom locked by a prismatic joint.
|
||||||
const LOCKED_PRISMATIC_AXES = Self::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.
|
/// The set of degrees of freedom locked by a fixed joint.
|
||||||
const LOCKED_FIXED_AXES = Self::X.bits | Self::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.
|
/// 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.
|
/// The set of degrees of freedom left free by a prismatic joint.
|
||||||
const FREE_PRISMATIC_AXES = Self::X.bits;
|
const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
|
||||||
/// The set of degrees of freedom left free by a fixed joint.
|
/// The set of degrees of freedom left free by a fixed joint.
|
||||||
const FREE_FIXED_AXES = 0;
|
const FREE_FIXED_AXES = 0;
|
||||||
/// The set of all translational degrees of freedom.
|
/// The set of all translational degrees of freedom.
|
||||||
const LIN_AXES = Self::X.bits() | Self::Y.bits();
|
const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits();
|
||||||
/// The set of all angular degrees of freedom.
|
/// The set of all angular degrees of freedom.
|
||||||
const ANG_AXES = Self::ANG_X.bits();
|
const ANG_AXES = Self::ANG_X.bits();
|
||||||
}
|
}
|
||||||
@@ -88,13 +88,13 @@ impl Default for JointAxesMask {
|
|||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
pub enum JointAxis {
|
pub enum JointAxis {
|
||||||
/// The translational degree of freedom along the joint’s local X axis.
|
/// The linear (translational) degree of freedom along the joint’s local X axis.
|
||||||
X = 0,
|
LinX = 0,
|
||||||
/// The translational degree of freedom along the joint’s local Y axis.
|
/// The linear (translational) degree of freedom along the joint’s local Y axis.
|
||||||
Y,
|
LinY,
|
||||||
/// The translational degree of freedom along the joint’s local Z axis.
|
/// The linear (translational) degree of freedom along the joint’s local Z axis.
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
Z,
|
LinZ,
|
||||||
/// The rotational degree of freedom along the joint’s local X axis.
|
/// The rotational degree of freedom along the joint’s local X axis.
|
||||||
AngX,
|
AngX,
|
||||||
/// The rotational degree of freedom along the joint’s local Y axis.
|
/// The rotational degree of freedom along the joint’s local Y axis.
|
||||||
|
|||||||
@@ -116,14 +116,14 @@ impl Multibody {
|
|||||||
delta_ang.z
|
delta_ang.z
|
||||||
];
|
];
|
||||||
|
|
||||||
if !options.constrained_axes.contains(JointAxesMask::X) {
|
if !options.constrained_axes.contains(JointAxesMask::LIN_X) {
|
||||||
delta[0] = 0.0;
|
delta[0] = 0.0;
|
||||||
}
|
}
|
||||||
if !options.constrained_axes.contains(JointAxesMask::Y) {
|
if !options.constrained_axes.contains(JointAxesMask::LIN_Y) {
|
||||||
delta[1] = 0.0;
|
delta[1] = 0.0;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
if !options.constrained_axes.contains(JointAxesMask::Z) {
|
if !options.constrained_axes.contains(JointAxesMask::LIN_Z) {
|
||||||
delta[2] = 0.0;
|
delta[2] = 0.0;
|
||||||
}
|
}
|
||||||
if !options.constrained_axes.contains(JointAxesMask::ANG_X) {
|
if !options.constrained_axes.contains(JointAxesMask::ANG_X) {
|
||||||
|
|||||||
@@ -92,19 +92,19 @@ impl PrismaticJoint {
|
|||||||
/// The motor affecting the joint’s translational degree of freedom.
|
/// The motor affecting the joint’s translational degree of freedom.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn motor(&self) -> Option<&JointMotor> {
|
pub fn motor(&self) -> Option<&JointMotor> {
|
||||||
self.data.motor(JointAxis::X)
|
self.data.motor(JointAxis::LinX)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
||||||
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
|
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
|
||||||
self.data.set_motor_model(JointAxis::X, model);
|
self.data.set_motor_model(JointAxis::LinX, model);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the target velocity this motor needs to reach.
|
/// Sets the target velocity this motor needs to reach.
|
||||||
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
|
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor_velocity(JointAxis::X, target_vel, factor);
|
.set_motor_velocity(JointAxis::LinX, target_vel, factor);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ impl PrismaticJoint {
|
|||||||
damping: Real,
|
damping: Real,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor_position(JointAxis::X, target_pos, stiffness, damping);
|
.set_motor_position(JointAxis::LinX, target_pos, stiffness, damping);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,25 +129,25 @@ impl PrismaticJoint {
|
|||||||
damping: Real,
|
damping: Real,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor(JointAxis::X, target_pos, target_vel, stiffness, damping);
|
.set_motor(JointAxis::LinX, target_pos, target_vel, stiffness, damping);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the maximum force the motor can deliver.
|
/// Sets the maximum force the motor can deliver.
|
||||||
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
|
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
|
||||||
self.data.set_motor_max_force(JointAxis::X, max_force);
|
self.data.set_motor_max_force(JointAxis::LinX, max_force);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The limit distance attached bodies can translate along the joint’s principal axis.
|
/// The limit distance attached bodies can translate along the joint’s principal axis.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn limits(&self) -> Option<&JointLimits<Real>> {
|
pub fn limits(&self) -> Option<&JointLimits<Real>> {
|
||||||
self.data.limits(JointAxis::X)
|
self.data.limits(JointAxis::LinX)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the `[min,max]` limit distances attached bodies can translate along the joint’s principal axis.
|
/// Sets the `[min,max]` limit distances attached bodies can translate along the joint’s principal axis.
|
||||||
pub fn set_limits(&mut self, limits: [Real; 2]) -> &mut Self {
|
pub fn set_limits(&mut self, limits: [Real; 2]) -> &mut Self {
|
||||||
self.data.set_limits(JointAxis::X, limits);
|
self.data.set_limits(JointAxis::LinX, limits);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ impl RopeJoint {
|
|||||||
|
|
||||||
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
||||||
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
|
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
|
||||||
self.data.set_motor_model(JointAxis::X, model);
|
self.data.set_motor_model(JointAxis::LinX, model);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the target velocity this motor needs to reach.
|
/// Sets the target velocity this motor needs to reach.
|
||||||
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
|
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor_velocity(JointAxis::X, target_vel, factor);
|
.set_motor_velocity(JointAxis::LinX, target_vel, factor);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ impl RopeJoint {
|
|||||||
damping: Real,
|
damping: Real,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor_position(JointAxis::X, target_pos, stiffness, damping);
|
.set_motor_position(JointAxis::LinX, target_pos, stiffness, damping);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,13 +106,13 @@ impl RopeJoint {
|
|||||||
damping: Real,
|
damping: Real,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.data
|
self.data
|
||||||
.set_motor(JointAxis::X, target_pos, target_vel, stiffness, damping);
|
.set_motor(JointAxis::LinX, target_pos, target_vel, stiffness, damping);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the maximum force the motor can deliver.
|
/// Sets the maximum force the motor can deliver.
|
||||||
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
|
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
|
||||||
self.data.set_motor_max_force(JointAxis::X, max_force);
|
self.data.set_motor_max_force(JointAxis::LinX, max_force);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ impl RopeJoint {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn max_distance(&self) -> Real {
|
pub fn max_distance(&self) -> Real {
|
||||||
self.data
|
self.data
|
||||||
.limits(JointAxis::X)
|
.limits(JointAxis::LinX)
|
||||||
.map(|l| l.max)
|
.map(|l| l.max)
|
||||||
.unwrap_or(Real::MAX)
|
.unwrap_or(Real::MAX)
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ impl RopeJoint {
|
|||||||
///
|
///
|
||||||
/// The `max_dist` must be strictly greater than 0.0.
|
/// The `max_dist` must be strictly greater than 0.0.
|
||||||
pub fn set_max_distance(&mut self, max_dist: Real) -> &mut Self {
|
pub fn set_max_distance(&mut self, max_dist: Real) -> &mut Self {
|
||||||
self.data.set_limits(JointAxis::X, [0.0, max_dist]);
|
self.data.set_limits(JointAxis::LinX, [0.0, max_dist]);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ impl SpringJoint {
|
|||||||
pub fn new(rest_length: Real, stiffness: Real, damping: Real) -> Self {
|
pub fn new(rest_length: Real, stiffness: Real, damping: Real) -> Self {
|
||||||
let data = GenericJointBuilder::new(JointAxesMask::empty())
|
let data = GenericJointBuilder::new(JointAxesMask::empty())
|
||||||
.coupled_axes(JointAxesMask::LIN_AXES)
|
.coupled_axes(JointAxesMask::LIN_AXES)
|
||||||
.motor_position(JointAxis::X, rest_length, stiffness, damping)
|
.motor_position(JointAxis::LinX, rest_length, stiffness, damping)
|
||||||
.motor_model(JointAxis::X, MotorModel::ForceBased)
|
.motor_model(JointAxis::LinX, MotorModel::ForceBased)
|
||||||
.build();
|
.build();
|
||||||
Self { data }
|
Self { data }
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ impl SpringJoint {
|
|||||||
/// `MotorModel::AccelerationBased`, the spring constants will be automatically scaled by the attached masses,
|
/// `MotorModel::AccelerationBased`, the spring constants will be automatically scaled by the attached masses,
|
||||||
/// making the spring more mass-independent.
|
/// making the spring more mass-independent.
|
||||||
pub fn set_spring_model(&mut self, model: MotorModel) -> &mut Self {
|
pub fn set_spring_model(&mut self, model: MotorModel) -> &mut Self {
|
||||||
self.data.set_motor_model(JointAxis::X, model);
|
self.data.set_motor_model(JointAxis::LinX, model);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user