Friction Question

Topics: Developer Forum, User Forum
Mar 3, 2009 at 4:15 AM
Hi all, i was wondering how you guys applied friction to objects in farseer. Just curious. I poked around and i couldn't find much anything relating to friction.
Mar 3, 2009 at 9:59 AM
For air friction use


For surface friction use

Mar 3, 2009 at 12:17 PM
You are right RCIX, there is not much related to friction. That's because it does not require a lot :)

Basically what we have is the following:

FrictionCoefficient: The friction coefficient that a geometry has. Friction is the force resisting the lateral motion of an object. Friction depends on the kind of surface that bodies (geometries on our case) have. Some say that coefficient of friction is always < 1, but this is not correct (you can also have higher than 1 in FP) as larger than 1 is just telling us that the force required to move an object along a surface is greater than the normal force of the surface on the object.

FrictionType: We have 2 types of friction in FP. Average and Minimum. Average takes the average of the friction of the two geometries colliding. Minimum just takes the lowest friction of the two geometries.

Those are the properties an settings that our users can see from the outside. But I guess (based on your other posts) than you would like to know more. So here you go:

Inside Arbiter.cs is where the friction-magic happens. We see what kind of friction type our users have set and calculate the appropriate friction coefficient from that. (Simply by finding the min or avg friction). The result is put into the private memeber _frictionCoefficientCombined.

Inside Arbiter.ApplyImpulse() is where we use this "combined" friction coefficient. Take a look from the comment "//compute friction impulse" and down. All that is the friction being calculated. If you are wondering what the tangent is and the like take a look at this wiki article and the picture to the right.

Mar 4, 2009 at 3:55 AM
@jordos: thanks but i was wondering how the friction is applied (what code makes friction work), not how to add it to my bodies in farseer.
@genbox: Thanks for all of that, but i was wondering how to calculate friction for say two circlescolliding against one onther and i thought that your code might help.