Skip to content

Commit

Permalink
Improve/Solve fast physics time step issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xtreme8000 committed May 2, 2020
1 parent 1fa76b1 commit 7d4a3b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.c
Expand Up @@ -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);
Expand All @@ -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;
}
}

0 comments on commit 7d4a3b3

Please sign in to comment.