How to rotate and move wheels

Official forum for the Chipmunk2D Physics Library.
Post Reply
ad126
Posts: 3
Joined: Wed May 26, 2010 2:50 pm
Contact:

How to rotate and move wheels

Post by ad126 »

Hi I am learning chipmunk and I am trying to get a simple circle shape ball to rotate on a surface like a wheel and move forward. How can I do this?

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

Re: How to rotate and move wheels

Post by slembcke »

You can attach a motor constraint to it if you want it to be powered, or you can just set the rotational velocity of the body if you just want to get it rolling.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
ad126
Posts: 3
Joined: Wed May 26, 2010 2:50 pm
Contact:

Re: How to rotate and move wheels

Post by ad126 »

Thanks for your reply slembcke. Setting the rotational velocity seems to work, but I'm not sure what the two constrained bodies would be for a simple motor on a single wheel.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to rotate and move wheels

Post by slembcke »

The motor adds torque between two bodies. In the real world it's impossible to make a wheel twist against itself (or nothing). On a vehicle, you would attach the motor from the wheel to the chassis. If you just want to make a self powered wheel you can attach the other end of the motor to the static body that you attach your static geometry to.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests