Skip to content

Instantly share code, notes, and snippets.

@lalanikarim
Created September 11, 2012 04:29
Show Gist options
  • Save lalanikarim/3695967 to your computer and use it in GitHub Desktop.
Save lalanikarim/3695967 to your computer and use it in GitHub Desktop.
Advancing Physics
LastDelta = DeltaTime;
CurrentTime = irrTimer->getTime();
DeltaTime = CurrentTime - TimeStamp;
TimeStamp = CurrentTime;
if(LastDelta != 0)
{
if(DeltaTime > LastDelta * 1.2f) DeltaTime = LastDelta * 1.2f;
if(DeltaTime < LastDelta * 0.8f) DeltaTime = LastDelta * 0.8f;
}
if(DeltaTime > 1.0f / 45.0f) DeltaTime = 1.0f/45.0f;
world->Advance(DeltaTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment