diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-07-04 09:02:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-04 09:02:30 +0200 |
| commit | 9d9129192835afab572ba318f60df4e12da6551b (patch) | |
| tree | b5665abb9c97469354c8c4dfd1a3fca21057ce16 /src/dynamics/joint/revolute_joint.rs | |
| parent | cd0be8c076c69b88bb1848de72228225eeccb52d (diff) | |
| parent | 5063f3bb4fec2716f78a208552ee260f22428840 (diff) | |
| download | rapier-9d9129192835afab572ba318f60df4e12da6551b.tar.gz rapier-9d9129192835afab572ba318f60df4e12da6551b.tar.bz2 rapier-9d9129192835afab572ba318f60df4e12da6551b.zip | |
Merge pull request #356 from dimforge/disable-joint-contacts
Add the ability to disable contacts between two rigid-bodies attached by joints
Diffstat (limited to 'src/dynamics/joint/revolute_joint.rs')
| -rw-r--r-- | src/dynamics/joint/revolute_joint.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/dynamics/joint/revolute_joint.rs b/src/dynamics/joint/revolute_joint.rs index 28e3968..9400ba8 100644 --- a/src/dynamics/joint/revolute_joint.rs +++ b/src/dynamics/joint/revolute_joint.rs @@ -10,7 +10,8 @@ use crate::math::UnitVector; #[repr(transparent)] /// A revolute joint, locks all relative motion except for rotation along the joint’s principal axis. pub struct RevoluteJoint { - data: GenericJoint, + /// The underlying joint data. + pub data: GenericJoint, } impl RevoluteJoint { @@ -38,6 +39,17 @@ impl RevoluteJoint { &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> { @@ -136,7 +148,7 @@ impl Into<GenericJoint> for RevoluteJoint { /// A revolute joint locks all relative motion except for rotations along the joint’s principal axis. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Copy, Clone, Debug, PartialEq)] -pub struct RevoluteJointBuilder(RevoluteJoint); +pub struct RevoluteJointBuilder(pub RevoluteJoint); impl RevoluteJointBuilder { /// Creates a new revolute joint builder. @@ -153,6 +165,13 @@ impl RevoluteJointBuilder { Self(RevoluteJoint::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 { |
