pub struct FixedJoint<const D: usize> {
pub body_a: BodyHandle,
pub body_b: BodyHandle,
pub anchor_a: SVector<f64, D>,
pub anchor_b: SVector<f64, D>,
pub stiffness: f64,
}Expand description
Fixed joint: locks two bodies at a fixed relative position.
The joint maintains the initial relative offset anchor_b - anchor_a
(in world space at the time of creation). All translational DOF are removed.
Fields§
§body_a: BodyHandle§body_b: BodyHandle§anchor_a: SVector<f64, D>Local-space anchor on body A.
anchor_b: SVector<f64, D>Local-space anchor on body B.
stiffness: f64Constraint stiffness [0, 1]. 1.0 = rigid, <1.0 = allows some drift.
Implementations§
Source§impl<const D: usize> FixedJoint<D>
impl<const D: usize> FixedJoint<D>
Sourcepub fn new(body_a: BodyHandle, body_b: BodyHandle) -> Self
pub fn new(body_a: BodyHandle, body_b: BodyHandle) -> Self
Create a fixed joint connecting body A and body B at their current positions. The anchors default to the body origins.
Sourcepub fn with_anchors(
body_a: BodyHandle,
body_b: BodyHandle,
anchor_a: SVector<f64, D>,
anchor_b: SVector<f64, D>,
) -> Self
pub fn with_anchors( body_a: BodyHandle, body_b: BodyHandle, anchor_a: SVector<f64, D>, anchor_b: SVector<f64, D>, ) -> Self
Create with specific local-space anchors.
Trait Implementations§
Source§impl<const D: usize> Constraint<D> for FixedJoint<D>
impl<const D: usize> Constraint<D> for FixedJoint<D>
Source§fn bodies(&self) -> (BodyHandle, BodyHandle)
fn bodies(&self) -> (BodyHandle, BodyHandle)
The two bodies this constraint connects.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Cast to std::any::Any for downcasting in tests/lab.
Source§fn solve(&self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64)
fn solve(&self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64)
Solve the constraint by applying positional corrections.
Called multiple times per frame for iterative convergence.
Source§fn solve_velocity(
&self,
body_a: &mut RigidBody<D>,
body_b: &mut RigidBody<D>,
_dt: f64,
_callback: Option<&mut dyn PhysicsCallback<D>>,
)
fn solve_velocity( &self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64, _callback: Option<&mut dyn PhysicsCallback<D>>, )
Optional velocity-level correction (impulse-based, Fix 7).
Called after position solve for hybrid PBD+impulse dynamics.
Default: no-op (pure PBD).
Auto Trait Implementations§
impl<const D: usize> Freeze for FixedJoint<D>
impl<const D: usize> RefUnwindSafe for FixedJoint<D>
impl<const D: usize> Send for FixedJoint<D>
impl<const D: usize> Sync for FixedJoint<D>
impl<const D: usize> Unpin for FixedJoint<D>
impl<const D: usize> UnsafeUnpin for FixedJoint<D>
impl<const D: usize> UnwindSafe for FixedJoint<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.