pub fn compute_normal_impulse(
        &self,
        a: &Physics,
        b: Option<&Physics>,
        config: &PhysicsConfig,
        dt: &UpdateDt,
    ) -> f32 {
        let delta_v =
            b.map(|b| b.velocity.linear).unwrap_or_else(Vector3::zeros) - a.velocity.linear;
        let k_n = a.mass_data.inv_mass + b.map(|b| b.mass_data.inv_mass).unwrap_or(0.);
        let v_bias = self.compute_bias_velocity(config, dt);
        let e = b.map_or(a.restitution, |b| a.restitution.min(b.restitution));

        (-(1. + e) * delta_v.dot(&self.contact.normal) + v_bias) / k_n
    }
/// Compute the required impulse to satisfy the constraint.
Compute the required impulse to satisfy the constraint.
Compute the required impulse to satisfy the constraint .
pub fn compute_normal_impulse(
        &self,
        a: &Physics,
        b: Option<&Physics>,
        config: &PhysicsConfig,
        dt: &UpdateDt,
    ) -> f32 {
        let delta_v =
            b.map(|b| b.velocity.linear).unwrap_or_else(Vector3::zeros) - a.velocity.linear;
        let k_n = a.mass_data.inv_mass + b.map(|b| b.mass_data.inv_mass).unwrap_or(0.);
        let v_bias = self.compute_bias_velocity(config, dt);
        let e = b.map_or(a.restitution, |b| a.restitution.min(b.restitution));
        (-(1. + e) * delta_v.dot(&self.contact.normal) + v_bias) / k_n
    }
pub fn compute_normal_impulse ( & self , a : & Physics , b : Option < & Physics > , config : & PhysicsConfig , dt : & UpdateDt , ) -> f32 { let delta_v = b . map ( | b | b . velocity . linear ) . unwrap_or_else ( Vector3 :: zeros ) - a . velocity . linear ; let k_n = a . mass_data . inv_mass + b . map ( | b | b . mass_data . inv_mass ) . unwrap_or ( 0. ) ; let v_bias = self . compute_bias_velocity ( config , dt ) ; let e = b . map_or ( a . restitution , | b | a . restitution . min ( b . restitution ) ) ; ( - ( 1. + e ) * delta_v . dot ( & self . contact . normal ) + v_bias ) / k_n }
Compute the required impulse to satisfy the constraint.
Compute the required impulse to satisfy the constraint .
&self
a
&Physics
b
Option<&Physics>
config
&PhysicsConfig
dt
&UpdateDt
&self
a
&Physics
b
Option<&Physics>
config
&PhysicsConfig
dt
&UpdateDt