# 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.

## 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 on other sites

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.

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 72
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632967
• Total Posts
3009576
• ### Who's Online (See full list)

There are no registered users currently online

×