Sign in to follow this  
Endemoniada

Physics without Timestep ?

Recommended Posts

Hi,

I got oliii's 2D physics tutorials up and running, in particular the rigid body with rotations one, and I notice it doesn't use the frame's elapsed time anywhere.

Like this:


void GameUpdate(float dt)
{
for(int i = 0; i < bodycount; i ++){
body[i].update();
}

for(int i = 0; i < bodycount; i ++){
for(int j = i+1; j < bodycount; j ++){
// both bodies static. skip
if(body[i].m_invmass == 0.0f && body[j].m_invmass == 0.0f)
continue;

CollisionReport report(&body[i], &body[j]);

if(report.m_collisionReported){
report.applyReponse(0.3f, 0.9f);
}
}
}
}


Notice dt isn't being used.

So one unit per second is really 60 units per second (at 60hz) and it doesn't take into account variable frame rates.

Am I missing something ?

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this