Skip to content

Instantly share code, notes, and snippets.

@jrenner
Created December 22, 2013 09:51
Show Gist options
  • Save jrenner/8080407 to your computer and use it in GitHub Desktop.
Save jrenner/8080407 to your computer and use it in GitHub Desktop.
float frameTime = dt;
if (frameTime > 0.5f) {
frameTime = 0.5f;
}
accumulatedDT += frameTime;
while (accumulatedDT >= Physics.TIME_STEP) {
frame++;
tick();
Physics.runPhysics();
//System.out.printf("ran physics - accum: %.3f\n", accumulatedDT);
accumulatedDT -= Physics.TIME_STEP; // 1/60f
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment