Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

Physics without Timestep ?

This topic is 2874 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
Is dt used inside of update()?
It may make sense for applyReponse not to use dt if it's an impulse force.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!