fix: include the 0.5 factor in pseudo (mass-normalized) kinetic energy calculation

This commit is contained in:
Sébastien Crozet
2024-04-28 15:47:49 +02:00
committed by Sébastien Crozet
parent 2678b08bf4
commit 5867d2e78d

View File

@@ -571,10 +571,11 @@ impl RigidBodyVelocity {
/// The approximate kinetic energy of this rigid-body. /// The approximate kinetic energy of this rigid-body.
/// ///
/// This approximation does not take the rigid-body's mass and angular inertia /// This approximation does not take the rigid-body's mass and angular inertia
/// into account. /// into account. Some physics engines call this the "mass-normalized kinetic
/// energy".
#[must_use] #[must_use]
pub fn pseudo_kinetic_energy(&self) -> Real { pub fn pseudo_kinetic_energy(&self) -> Real {
self.linvel.norm_squared() + self.angvel.gdot(self.angvel) 0.5 * (self.linvel.norm_squared() + self.angvel.gdot(self.angvel))
} }
/// Returns the update velocities after applying the given damping. /// Returns the update velocities after applying the given damping.