Add the ability to disable contacts between two rigid-bodies attached by joints
This commit is contained in:
@@ -9,7 +9,8 @@ use super::{JointLimits, JointMotor};
|
||||
#[repr(transparent)]
|
||||
/// A prismatic joint, locks all relative motion between two bodies except for translation along the joint’s principal axis.
|
||||
pub struct PrismaticJoint {
|
||||
data: GenericJoint,
|
||||
/// The underlying joint data.
|
||||
pub data: GenericJoint,
|
||||
}
|
||||
|
||||
impl PrismaticJoint {
|
||||
@@ -29,6 +30,17 @@ impl PrismaticJoint {
|
||||
&self.data
|
||||
}
|
||||
|
||||
/// Are contacts between the attached rigid-bodies enabled?
|
||||
pub fn contacts_enabled(&self) -> bool {
|
||||
self.data.contacts_enabled
|
||||
}
|
||||
|
||||
/// Sets whether contacts between the attached rigid-bodies are enabled.
|
||||
pub fn set_contacts_enabled(&mut self, enabled: bool) -> &mut Self {
|
||||
self.data.set_contacts_enabled(enabled);
|
||||
self
|
||||
}
|
||||
|
||||
/// The joint’s anchor, expressed in the local-space of the first rigid-body.
|
||||
#[must_use]
|
||||
pub fn local_anchor1(&self) -> Point<Real> {
|
||||
@@ -149,8 +161,9 @@ impl Into<GenericJoint> for PrismaticJoint {
|
||||
/// Create prismatic joints using the builder pattern.
|
||||
///
|
||||
/// A prismatic joint locks all relative motion except for translations along the joint’s principal axis.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub struct PrismaticJointBuilder(PrismaticJoint);
|
||||
pub struct PrismaticJointBuilder(pub PrismaticJoint);
|
||||
|
||||
impl PrismaticJointBuilder {
|
||||
/// Creates a new builder for prismatic joints.
|
||||
@@ -160,6 +173,13 @@ impl PrismaticJointBuilder {
|
||||
Self(PrismaticJoint::new(axis))
|
||||
}
|
||||
|
||||
/// Sets whether contacts between the attached rigid-bodies are enabled.
|
||||
#[must_use]
|
||||
pub fn contacts_enabled(mut self, enabled: bool) -> Self {
|
||||
self.0.set_contacts_enabled(enabled);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the joint’s anchor, expressed in the local-space of the first rigid-body.
|
||||
#[must_use]
|
||||
pub fn local_anchor1(mut self, anchor1: Point<Real>) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user