how do you properly update the physics engine? I've read the documentation on how its supposed to work, and this is what I came up with:
at first this seemed to work really well. Now, however, i'm rendering much more geometry per frame, and the physics seem really choppy. The framerate still sticks at 60 fps though. How am I supposed to be updating?
Code:
//Global Variables:
float timeStep = 1.0f / 60.0f;
int iterations = 10;
float tstep_counter=0.0f;
int tsteps_thisframe;
// This is called during my program's update routine:
// tick counts are in milliseconds, so 1000's...
tstep_counter += (float)tickCount - (float)lastTickCount;
// 16.66f is (1/60)*1000
tsteps_thisframe = (int)(tstep_counter/16.66f);
for(int i=0; i<tsteps_thisframe; i++)
{
myWorld->Step(timeStep, iterations);
tstep_counter-=16.66f;
}
float timeStep = 1.0f / 60.0f;
int iterations = 10;
float tstep_counter=0.0f;
int tsteps_thisframe;
// This is called during my program's update routine:
// tick counts are in milliseconds, so 1000's...
tstep_counter += (float)tickCount - (float)lastTickCount;
// 16.66f is (1/60)*1000
tsteps_thisframe = (int)(tstep_counter/16.66f);
for(int i=0; i<tsteps_thisframe; i++)
{
myWorld->Step(timeStep, iterations);
tstep_counter-=16.66f;
}
at first this seemed to work really well. Now, however, i'm rendering much more geometry per frame, and the physics seem really choppy. The framerate still sticks at 60 fps though. How am I supposed to be updating?