From 05c4522e5ff424c65aab7cd36c7a15313630ac61 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sun, 25 Jul 2021 20:20:10 -0400 Subject: (mkosarek) Fix for wrong timestep --- 2d/rigidbody/rigidbody_2/dist/output.wasm | Bin 50226 -> 50452 bytes 2d/rigidbody/rigidbody_2/main.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to '2d/rigidbody/rigidbody_2') diff --git a/2d/rigidbody/rigidbody_2/dist/output.wasm b/2d/rigidbody/rigidbody_2/dist/output.wasm index 29c319a..fb79e45 100755 Binary files a/2d/rigidbody/rigidbody_2/dist/output.wasm and b/2d/rigidbody/rigidbody_2/dist/output.wasm differ diff --git a/2d/rigidbody/rigidbody_2/main.cpp b/2d/rigidbody/rigidbody_2/main.cpp index 123cf7e..44a3c53 100644 --- a/2d/rigidbody/rigidbody_2/main.cpp +++ b/2d/rigidbody/rigidbody_2/main.cpp @@ -69,7 +69,7 @@ struct Rigidbody { float32 impulseDtSeconds = nextTimeAppliedSeconds - i.timeAppliedSeconds; Vector2 forceToApply = i.force * (impulseDtSeconds / i.timeOfApplicationSeconds); - force += forceToApply * impulseDtSeconds; + force += forceToApply; // New! Increment the torque for each force torque += i.pointOfApplication.getPerp().dot(forceToApply); -- cgit v1.2.1