pub trait AngularConstraint: XpbdConstraint<2> {
// Provided methods
fn apply_angular_lagrange_update(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
delta_lagrange: Scalar,
) -> Scalar { ... }
fn apply_angular_impulse(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
impulse: Scalar,
) -> Scalar { ... }
fn align_orientation(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
angle: Scalar,
lagrange: &mut Scalar,
compliance: Scalar,
dt: Scalar,
) -> Scalar { ... }
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(inverse_inertia: Scalar, p: Scalar) -> Scalar { ... }
fn compute_torque(&self, lagrange: Scalar, dt: Scalar) -> Scalar { ... }
}
Expand description
An angular constraint applies an angular correction around a given axis.
Provided Methods§
Sourcefn apply_angular_lagrange_update(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
delta_lagrange: Scalar,
) -> Scalar
fn apply_angular_lagrange_update( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, delta_lagrange: Scalar, ) -> Scalar
Applies an angular correction to two bodies.
Returns the angular impulse that is applied proportional to the inverse moments of inertia of the bodies.
Sourcefn apply_angular_impulse(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
impulse: Scalar,
) -> Scalar
fn apply_angular_impulse( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, impulse: Scalar, ) -> Scalar
Applies an angular impulse to two bodies.
Returns the impulse that is applied proportional to the inverse moments of inertia of the bodies.
Sourcefn align_orientation(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
angle: Scalar,
lagrange: &mut Scalar,
compliance: Scalar,
dt: Scalar,
) -> Scalar
fn align_orientation( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, angle: Scalar, lagrange: &mut Scalar, compliance: Scalar, dt: Scalar, ) -> Scalar
Applies an angular correction that aligns the orientation of the bodies.
Returns the torque exerted by the alignment.
Sourcefn apply_angular_correction(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
delta_lagrange: Scalar,
axis: Vector3,
) -> Scalar
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.
Sourcefn compute_generalized_inverse_mass(
&self,
body: &RigidBodyQueryItem<'_>,
axis: Vector3,
) -> Scalar
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.
Sourcefn get_delta_rot(inverse_inertia: Scalar, p: Scalar) -> Scalar
fn get_delta_rot(inverse_inertia: Scalar, p: Scalar) -> Scalar
Computes the update in rotation when applying an angular correction p
.
Sourcefn compute_torque(&self, lagrange: Scalar, dt: Scalar) -> Scalar
fn compute_torque(&self, lagrange: Scalar, dt: Scalar) -> Scalar
Computes the torque acting along the constraint using the equation tau = lambda * n / h^2
,
where n
is the Z axis in 2D.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.