• Advertisement
Sign in to follow this  

Physics without Timestep ?

This topic is 2692 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.update();
}

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

CollisionReport report(&body, &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
Advertisement
Sign in to follow this  

  • Advertisement