Skip to main content

FixedJoint

Struct FixedJoint 

Source
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: f64

Constraint stiffness [0, 1]. 1.0 = rigid, <1.0 = allows some drift.

Implementations§

Source§

impl<const D: usize> FixedJoint<D>

Source

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.

Source

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>

Source§

fn bodies(&self) -> (BodyHandle, BodyHandle)

The two bodies this constraint connects.
Source§

fn as_any(&self) -> &dyn Any

Cast to std::any::Any for downcasting in tests/lab.
Source§

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)

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>>, )

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.