Jump to content
  • Advertisement
Sign in to follow this  
nerdboy64

Modeling of ground friction in 2d impulse engine

This topic is 1322 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

I'm making a 2D tank game using a custom impulse physics engine based on this tutorial. However, the author's physics engine differs from mine in that it uses a side-scroller type view whereas mine is top-down. While in most cases the physics are the same, one important difference is that in my game, everything is constantly in contact with the ground. Therefore, everything is constantly subject to extra friction or other "resisting" forces which can be modeled by the same formula.

 

Modeling this with some degree of realism has me fairly well stumped. Linear motion is confusing enough, since it probably requires some heinous calculation involving the mass of the object. Rotation sounds even worse, because it requires calculation of torque based on multiple contact vectors. Can anyone link me a tutorial or point me in the right direction? I've tried Googling around, but it hasn't turned up anything.

Share this post


Link to post
Share on other sites
Advertisement

You can try to use the friction solver just like in the demo, except in the demo the friction is being solved along the tangent axis. In your case, you want to friction along a 2D plane, which requires two vectors to span all of 2D space. This means you'd need to run the friction solver twice, once for each axis in the 2D plane.

 

Alternatively you can try a much hackier solution, which is to just damp out the velocity with a high damping coefficient (see Box2D island.cpp, search in comments for "Pade approximation").

 

All in all you're trying to solve a math problem, so be sure to study any reference code you can find and try to perform the derivations yourself.

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!