Fixed rotating wheel

Official forum for the Chipmunk2D Physics Library.
Post Reply
Brainfart
Posts: 1
Joined: Thu May 20, 2010 4:01 pm
Contact:

Fixed rotating wheel

Post by Brainfart »

Hi,

Does anyone have any idea how I would create a spinning wheel that is in a fixed position but infinately spins? The axis could be at any part of the wheel but for simplicity I can start with it at the center and I want it to collide with any body that hits it.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Fixed rotating wheel

Post by slembcke »

If the wheel is rotating exactly around it's center, then it's very easy. Create a new static body (infinite mass and moment of inertia, don't add it to the space), set it's rotational velocity (body->w), and add a static circle shape to it with no offset.

The body won't actually be rotating, but anything that touches it will think it is. Because the rotation is happening around the body's exact center, the response will look correct. You'll have to handle the graphics differently for it though.

If you want something more flexible, you'll have to update the velocity and position of the static body yourself.
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 31 guests