Add the ability to disable contacts between two rigid-bodies attached by joints
This commit is contained in:
@@ -6,7 +6,8 @@ use crate::math::{Isometry, Point, Real};
|
||||
#[repr(transparent)]
|
||||
/// A fixed joint, locks all relative motion between two bodies.
|
||||
pub struct FixedJoint {
|
||||
data: GenericJoint,
|
||||
/// The underlying joint data.
|
||||
pub data: GenericJoint,
|
||||
}
|
||||
|
||||
impl Default for FixedJoint {
|
||||
@@ -23,6 +24,17 @@ impl FixedJoint {
|
||||
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 frame, expressed in the first rigid-body’s local-space.
|
||||
#[must_use]
|
||||
pub fn local_frame1(&self) -> &Isometry<Real> {
|
||||
@@ -81,7 +93,7 @@ impl Into<GenericJoint> for FixedJoint {
|
||||
/// Create fixed joints using the builder pattern.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Default)]
|
||||
pub struct FixedJointBuilder(FixedJoint);
|
||||
pub struct FixedJointBuilder(pub FixedJoint);
|
||||
|
||||
impl FixedJointBuilder {
|
||||
/// Creates a new builder for fixed joints.
|
||||
@@ -89,6 +101,13 @@ impl FixedJointBuilder {
|
||||
Self(FixedJoint::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 frame, expressed in the first rigid-body’s local-space.
|
||||
#[must_use]
|
||||
pub fn local_frame1(mut self, local_frame: Isometry<Real>) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user