Trait bevy_xpbd_2d::constraints::AngularConstraint
source · 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§
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.
Object Safety§
This trait is not object safe.