From 7d4a3b336723d448e9090e2e48f6595b2f941561 Mon Sep 17 00:00:00 2001 From: xtreme8000 Date: Sat, 2 May 2020 12:12:33 +0200 Subject: [PATCH] Improve/Solve fast physics time step issue --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 6856aa4..1f2f7e5 100644 --- a/src/main.c +++ b/src/main.c @@ -693,8 +693,8 @@ int main(int argc, char** argv) { } // these run at min. ~60fps but as fast as possible - while(physics_time_fast > 0) { - double step = fmin(dt, PHYSICS_STEP_TIME); + double step = fmin(dt, PHYSICS_STEP_TIME); + while(physics_time_fast >= step) { physics_time_fast -= step; player_update(step, 0); // smooth orientation update camera_update(step); @@ -719,6 +719,6 @@ int main(int argc, char** argv) { nanosleep(&ts, NULL); } - fps = 1.0F / (window_time() - last_frame_start); + fps = 1.0F / dt; } }