• Advertisement
Sign in to follow this  

Dynamic friction 2D rigid body

This topic is 1932 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've looked at Chris heckers columns on rigid body physics and was able to implement a frictionless rigid body simulation,however, now I'm looking to implement dynamic friction.Unfortunately there doesn't seem to be alot of information available on how to achieve this on the net or maybe I haven't been looking hard enough. In any case I've come here to ask for assistance on how to achieve dynamic friction in my 2D rigid body simulation.

Here's a temporary clip of what the simulation looks like currently:

Share this post


Link to post
Share on other sites
Advertisement
Apart from the usual: use a physics engine. I'll assume you're doing this out of interest in learning, in which case I'd recommend looking at box2dlite and erin-catto's presentations (available on box2d.googlecode.com) which will also help you deal with resting contacts (no jittering the way you have)

Share this post


Link to post
Share on other sites
First of all you'll need an equation which lets you remove velocity in one dimension via an impulse. If you have frictionless collision resolution working already, you have this equation to hand (you're using it to remove velocity in the contact normal direction).

So, next step is to find the velocity component in the tangential direction that you want to remove to create friction.

* Form the tangent vector using the perp operator on the contact normal
* Get the relative tangential velocity by dotting total relative contact point velocity against the tangent vector
* Now, you can then generate an impulse to remove some or all of this tangential velocity (most text books say the magnitude of this impulse should be bounded by the magnitude of the normal impulse, but if you just want infinite friction, remove the whole lot)

Job done smile.png Edited by wildbunny

Share this post


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

  • Advertisement