Trait avian3d::dynamics::solver::joints::Joint

source ·
pub trait Joint: Component + PositionConstraint + AngularConstraint {
    // Required methods
    fn new(entity1: Entity, entity2: Entity) -> Self;
    fn with_compliance(self, compliance: Scalar) -> Self;
    fn with_local_anchor_1(self, anchor: Vector) -> Self;
    fn with_local_anchor_2(self, anchor: Vector) -> Self;
    fn with_linear_velocity_damping(self, damping: Scalar) -> Self;
    fn with_angular_velocity_damping(self, damping: Scalar) -> Self;
    fn local_anchor_1(&self) -> Vector;
    fn local_anchor_2(&self) -> Vector;
    fn damping_linear(&self) -> Scalar;
    fn damping_angular(&self) -> Scalar;

    // Provided method
    fn align_position(
        &self,
        body1: &mut RigidBodyQueryItem<'_>,
        body2: &mut RigidBodyQueryItem<'_>,
        r1: Vector,
        r2: Vector,
        lagrange: &mut Scalar,
        compliance: Scalar,
        dt: Scalar
    ) -> Vector { ... }
}
Expand description

A trait for joints.

Required Methods§

source

fn new(entity1: Entity, entity2: Entity) -> Self

Creates a new joint between two entities.

source

fn with_compliance(self, compliance: Scalar) -> Self

Sets the joint’s compliance (inverse of stiffness, meters / Newton).

source

fn with_local_anchor_1(self, anchor: Vector) -> Self

Sets the attachment point on the first body.

source

fn with_local_anchor_2(self, anchor: Vector) -> Self

Sets the attachment point on the second body.

source

fn with_linear_velocity_damping(self, damping: Scalar) -> Self

Sets the linear velocity damping caused by the joint.

source

fn with_angular_velocity_damping(self, damping: Scalar) -> Self

Sets the angular velocity damping caused by the joint.

source

fn local_anchor_1(&self) -> Vector

Returns the local attachment point on the first body.

source

fn local_anchor_2(&self) -> Vector

Returns the local attachment point on the second body.

source

fn damping_linear(&self) -> Scalar

Returns the linear velocity damping of the joint.

source

fn damping_angular(&self) -> Scalar

Returns the angular velocity damping of the joint.

Provided Methods§

source

fn align_position( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, r1: Vector, r2: Vector, lagrange: &mut Scalar, compliance: Scalar, dt: Scalar ) -> Vector

Applies a positional correction that aligns the positions of the local attachment points r1 and r2.

Returns the force exerted by the alignment.

Object Safety§

This trait is not object safe.

Implementors§