Friction seems to have no effect

Official forum for the Chipmunk2D Physics Library.
Post Reply
Twernmilt
Posts: 3
Joined: Fri May 06, 2011 4:01 pm
Contact:

Friction seems to have no effect

Post by Twernmilt »

I'm sure this question comes up all the time, but I didn't find a definitive answer.
I have a poly shape representing a platform and a circle shape representing a character. I want the character to slow to a stop when no force is being applied to it.

I thought the obvious way to do that would be to control the friction of the two shapes. Not only did increasing their frictions not do this, it doesn't seem to do anything. It doesn't effect a change in the force that it takes to move the character or anything.

Can someone post an explanation for how friction works in Chipmunk and how to use it? Thanks!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Friction seems to have no effect

Post by slembcke »

I'm 99% certain that your circle is rolling. Friction only acts between two surfaces that are sliding past each other. If it is rolling across a flat surface, then there is no friction. In the real world, a rolling object slows down (ignoring drag) because the force of gravity squishes the shape of the two surfaces and this deformation acts a lot like friction. It's commonly referred to as rolling friction. Chipmunk does not support rolling friction.

What you probably want to do is prevent your circle from rotating. You can do that by using INFINITY as the moment of inertia for the rigid body when calling cpBodyNew(). Then the circle will be unable to roll, and instead it's surface will slide and friction will work.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Twernmilt
Posts: 3
Joined: Fri May 06, 2011 4:01 pm
Contact:

Re: Friction seems to have no effect

Post by Twernmilt »

This was in fact what was happening. I missed it because the rotation was so slight that I didn't notice it happening. Thank you!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Heise IT-Markt [Crawler] and 4 guests