pub trait AngularConstraint: XpbdConstraint<2> {
    // Provided methods
    fn apply_angular_correction(
        &self,
        body1: &mut RigidBodyQueryItem<'_>,
        body2: &mut RigidBodyQueryItem<'_>,
        delta_lagrange: Scalar,
        axis: Vector3
    ) -> Scalar { ... }
    fn compute_generalized_inverse_mass(
        &self,
        body: &RigidBodyQueryItem<'_>,
        axis: Vector3
    ) -> Scalar { ... }
    fn get_delta_rot(
        _rot: Rotation,
        inverse_inertia: Scalar,
        p: Scalar
    ) -> Rotation { ... }
    fn compute_torque(
        &self,
        lagrange: Scalar,
        axis: Vector3,
        dt: Scalar
    ) -> Scalar { ... }
}
Expand description

An angular constraint applies an angular correction around a given axis.

Provided Methods§

source

fn apply_angular_correction( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, delta_lagrange: Scalar, axis: Vector3 ) -> Scalar

Applies angular constraints for interactions between two bodies.

Here in 2D, axis is a unit vector with the Z coordinate set to 1 or -1. It controls if the body should rotate counterclockwise or clockwise.

Returns the angular impulse that is applied proportional to the inverse masses of the bodies.

source

fn compute_generalized_inverse_mass( &self, body: &RigidBodyQueryItem<'_>, axis: Vector3 ) -> Scalar

Computes the generalized inverse mass of a body when applying an angular correction around axis.

In 2D, axis should only have the z axis set to either -1 or 1 to indicate counterclockwise or clockwise rotation.

source

fn get_delta_rot(_rot: Rotation, inverse_inertia: Scalar, p: Scalar) -> Rotation

Computes the update in rotation when applying an angular correction p.

source

fn compute_torque(&self, lagrange: Scalar, axis: Vector3, dt: Scalar) -> Scalar

Computes the torque acting along the constraint using the equation tau = lambda * n / h^2

Object Safety§

This trait is not object safe.

Implementors§