Skip to content

Instantly share code, notes, and snippets.

@jrenner
Created December 5, 2013 07:34
Show Gist options
  • Save jrenner/7801531 to your computer and use it in GitHub Desktop.
Save jrenner/7801531 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment