aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/joint/fixed_joint.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-03-19 16:10:49 +0100
committerSébastien Crozet <sebastien@crozet.re>2022-03-20 21:49:16 +0100
commitdb6a8c526d939a125485c89cfb6e540422fe6b4b (patch)
tree32738172c6bd27e07ed9a4b8f90f5fbbfc07fd5e /src/dynamics/joint/fixed_joint.rs
parente2e6fc787112ab35a3d4858aa2cf83fcf41c16a2 (diff)
downloadrapier-db6a8c526d939a125485c89cfb6e540422fe6b4b.tar.gz
rapier-db6a8c526d939a125485c89cfb6e540422fe6b4b.tar.bz2
rapier-db6a8c526d939a125485c89cfb6e540422fe6b4b.zip
Fix warnings and add comments.
Diffstat (limited to 'src/dynamics/joint/fixed_joint.rs')
-rw-r--r--src/dynamics/joint/fixed_joint.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/dynamics/joint/fixed_joint.rs b/src/dynamics/joint/fixed_joint.rs
index 192b7d9..92f0d7c 100644
--- a/src/dynamics/joint/fixed_joint.rs
+++ b/src/dynamics/joint/fixed_joint.rs
@@ -4,6 +4,7 @@ use crate::math::{Isometry, Point, Real};
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(transparent)]
+/// A fixed joint, locks all relative motion between two bodies.
pub struct FixedJoint {
data: GenericJoint,
}
@@ -15,47 +16,56 @@ impl Default for FixedJoint {
}
impl FixedJoint {
+ /// Creates a new fixed joint.
#[must_use]
pub fn new() -> Self {
let data = GenericJointBuilder::new(JointAxesMask::LOCKED_FIXED_AXES).build();
Self { data }
}
+ /// The joint’s frame, expressed in the first rigid-body’s local-space.
#[must_use]
pub fn local_frame1(&self) -> &Isometry<Real> {
&self.data.local_frame1
}
+ /// Sets the joint’s frame, expressed in the first rigid-body’s local-space.
pub fn set_local_frame1(&mut self, local_frame: Isometry<Real>) -> &mut Self {
self.data.set_local_frame1(local_frame);
self
}
+ /// The joint’s frame, expressed in the second rigid-body’s local-space.
#[must_use]
pub fn local_frame2(&self) -> &Isometry<Real> {
&self.data.local_frame2
}
+ /// Sets joint’s frame, expressed in the second rigid-body’s local-space.
pub fn set_local_frame2(&mut self, local_frame: Isometry<Real>) -> &mut Self {
self.data.set_local_frame2(local_frame);
self
}
+ /// The joint’s anchor, expressed in the local-space of the first rigid-body.
#[must_use]
pub fn local_anchor1(&self) -> Point<Real> {
self.data.local_anchor1()
}
+ /// Sets the joint’s anchor, expressed in the local-space of the first rigid-body.
pub fn set_local_anchor1(&mut self, anchor1: Point<Real>) -> &mut Self {
self.data.set_local_anchor1(anchor1);
self
}
+ /// The joint’s anchor, expressed in the local-space of the second rigid-body.
#[must_use]
pub fn local_anchor2(&self) -> Point<Real> {
self.data.local_anchor2()
}
+ /// Sets the joint’s anchor, expressed in the local-space of the second rigid-body.
pub fn set_local_anchor2(&mut self, anchor2: Point<Real>) -> &mut Self {
self.data.set_local_anchor2(anchor2);
self
@@ -68,39 +78,46 @@ 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);
impl FixedJointBuilder {
+ /// Creates a new builder for fixed joints.
pub fn new() -> Self {
Self(FixedJoint::new())
}
+ /// 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 {
self.0.set_local_frame1(local_frame);
self
}
+ /// Sets joint’s frame, expressed in the second rigid-body’s local-space.
#[must_use]
pub fn local_frame2(mut self, local_frame: Isometry<Real>) -> Self {
self.0.set_local_frame2(local_frame);
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 {
self.0.set_local_anchor1(anchor1);
self
}
+ /// Sets the joint’s anchor, expressed in the local-space of the second rigid-body.
#[must_use]
pub fn local_anchor2(mut self, anchor2: Point<Real>) -> Self {
self.0.set_local_anchor2(anchor2);
self
}
+ /// Build the fixed joint.
#[must_use]
pub fn build(self) -> FixedJoint {
self.0