Trait pixel_game_lib::physics::constraint::Constraint
source · pub trait Constraint<const RIGIDBODIES: usize> {
// Required methods
fn lambda(&self) -> f64;
fn set_lambda(&mut self, lambda: f64);
fn solve(&mut self, rigidbodies: &mut View<'_, RigidBodyQuery<'_>>, dt: f64);
// Provided methods
fn reset(&mut self) { ... }
fn delta_lambda<const AMOUNT: usize>(
lambda: f64,
magnitude: f64,
compliance: f64,
gradients: [Vec2<f64>; AMOUNT],
attachments: [Vec2<f64>; AMOUNT],
bodies: [(InvMass, Inertia); AMOUNT],
dt: f64
) -> f64 { ... }
}
Expand description
XPBD constraint between one or more rigid bodies.
Required Methods§
sourcefn set_lambda(&mut self, lambda: f64)
fn set_lambda(&mut self, lambda: f64)
Set the lambda.
sourcefn solve(&mut self, rigidbodies: &mut View<'_, RigidBodyQuery<'_>>, dt: f64)
fn solve(&mut self, rigidbodies: &mut View<'_, RigidBodyQuery<'_>>, dt: f64)
Solve the constraint.
Applies the force immediately to the rigidbodies.
Provided Methods§
Object Safety§
This trait is not object safe.