Wheel spinning indefinitely

Official forum for the Chipmunk2D Physics Library.
Post Reply
chmukpunk
Posts: 4
Joined: Wed Jan 18, 2012 2:39 pm
Contact:

Wheel spinning indefinitely

Post by chmukpunk »

Hi,

I'm starting using Chipmunk Physics and I managed to create some car (chassis + wheels). But when the car crashes and is on the "roof", and the wheels toward the sky the car stands still (ok), but the wheels keep spinning indefinitely :(

I move the car by applying forces, impulses, or motor join (on one of the two), but in all cases, they spin at a constant speed. What can I do to slow them down?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Wheel spinning indefinitely

Post by slembcke »

Attach a cpSimpleMotor between the wheel and chassis. Set it's rate to zero (it wants to stop the spinning) and set the maxForce property to something small-ish (a low amount of friction slowing them down).

By varying the rate and maxForce properties you can control the car pretty well too. That's what a normally recommend people to do, but keep what you have if you are happy with it.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
chmukpunk
Posts: 4
Joined: Wed Jan 18, 2012 2:39 pm
Contact:

Re: Wheel spinning indefinitely

Post by chmukpunk »

I was happy with forces but cpSimpleMotor is nice for a smooth acceleration. And I understand well that wheels keep spinning with a motor (when rate is not set to Zero -- may be can I detect that car is "crashed") ?

But, what about when car is moved by impulses? Frictions between wheels and chassis should slow wheel down when:
- car is upside down
- wheels do not touch ground
- no more impulses.

I have a physic feeling of such behavior, but as I didn't set air friction / chassis vs. wheel friction, I'm not surprised that wheels keep spinning...
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests