Advertisement

Dynamic friction 2D rigid body

Started by October 07, 2012 02:51 AM
1 comment, last by wildbunny 12 years, 4 months ago
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:
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)
Advertisement
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

This topic is closed to new replies.

Advertisement