aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/joint/spherical_joint.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-06-23 16:23:39 +0200
committerSébastien Crozet <developer@crozet.re>2022-07-03 13:55:41 +0200
commit5063f3bb4fec2716f78a208552ee260f22428840 (patch)
treeb5665abb9c97469354c8c4dfd1a3fca21057ce16 /src/dynamics/joint/spherical_joint.rs
parentcd0be8c076c69b88bb1848de72228225eeccb52d (diff)
downloadrapier-5063f3bb4fec2716f78a208552ee260f22428840.tar.gz
rapier-5063f3bb4fec2716f78a208552ee260f22428840.tar.bz2
rapier-5063f3bb4fec2716f78a208552ee260f22428840.zip
Add the ability to disable contacts between two rigid-bodies attached by joints
Diffstat (limited to 'src/dynamics/joint/spherical_joint.rs')
-rw-r--r--src/dynamics/joint/spherical_joint.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/dynamics/joint/spherical_joint.rs b/src/dynamics/joint/spherical_joint.rs
index 89ab7b1..bce393c 100644
--- a/src/dynamics/joint/spherical_joint.rs
+++ b/src/dynamics/joint/spherical_joint.rs
@@ -9,7 +9,8 @@ use super::JointLimits;
#[repr(transparent)]
/// A spherical joint, locks all relative translations between two bodies.
pub struct SphericalJoint {
- data: GenericJoint,
+ /// The underlying joint data.
+ pub data: GenericJoint,
}
impl Default for SphericalJoint {
@@ -30,6 +31,17 @@ impl SphericalJoint {
&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> {
@@ -132,7 +144,7 @@ impl Into<GenericJoint> for SphericalJoint {
/// Create spherical joints using the builder pattern.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq)]
-pub struct SphericalJointBuilder(SphericalJoint);
+pub struct SphericalJointBuilder(pub SphericalJoint);
impl Default for SphericalJointBuilder {
fn default() -> Self {
@@ -146,6 +158,13 @@ impl SphericalJointBuilder {
Self(SphericalJoint::new())
}
+ /// 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 {