From 5867d2e78d9cdd6b495d22346c4f59ac25ff6d1b Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Sun, 28 Apr 2024 15:47:49 +0200 Subject: fix: include the 0.5 factor in pseudo (mass-normalized) kinetic energy calculation --- src/dynamics/rigid_body_components.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs index c03233d..f5698a4 100644 --- a/src/dynamics/rigid_body_components.rs +++ b/src/dynamics/rigid_body_components.rs @@ -571,10 +571,11 @@ impl RigidBodyVelocity { /// The approximate kinetic energy of this rigid-body. /// /// 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] 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. -- cgit