Apply friction to a pivot joint

Official forum for the Chipmunk2D Physics Library.
Post Reply
The Botanist
Posts: 4
Joined: Fri Nov 11, 2011 3:31 pm
Contact:

Apply friction to a pivot joint

Post by The Botanist »

Hello

The scenario: The idée in this top view game is, by using paddle and ball, deform and crumble a circle to a certain form (with no volume preservation). The circle has 64 segments and each segment is connected with the neighbour segments with pivot joints.
My knowledge in physics is poor but I imagine that to emulate this deforming process (plastic deformation) in Chipmunk Physics the pivot points should have a friction model (rotational) with both static and dynamic friction coefficients.
I am not sure how to implement this. Maybe with rotational damping, but damping and friction is not the same thing. Or should I apply counter-impulses against the torque.
I can (and will :D) experiment with this but I thought there might be experience in this forum about friction in pivot joints and maybe plastic deformation using CP.

Tommy
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Apply friction to a pivot joint

Post by slembcke »

Oooh. I see. It took me a while to figure out what you meant, but I think I understand.

So pivot joints don't have any rotary friction no, but you can emulate it with extra joints. The easiest way to apply rotary friction is with a specially configured gear joint. The gear joint should have a ratio of 1.0, meaning that it wants to make the bodies spin at the same speed. Then you also need to set the maxForce (torque in this case) that the joint is allowed to apply. That maxForce is your rotational friction.

As for static and dynamic friction, that is more tricky. Probably the easiest way to handle that is to change the gear joint's maxForce amount each frame either before calling cpSpaceStep() or by using the joint's pre-step callback. Compare the relative angular velocity of the two bodies to a threshold and set the static or dynamic amount based on that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
The Botanist
Posts: 4
Joined: Fri Nov 11, 2011 3:31 pm
Contact:

Re: Apply friction to a pivot joint

Post by The Botanist »

Thanks

Gear joints is surprisingly useful. I have already done some tests and it works very nicely. I vill use plastic deformation extensively and adjusting "maxForce" seems to do the job. Problem solved.

Tommy
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests