Bouncing

Official forum for the Chipmunk2D Physics Library.
Post Reply
martin.knotek
Posts: 2
Joined: Fri Feb 05, 2010 9:22 am
Contact:

Bouncing

Post by martin.knotek »

Hi, I’m trying create ball in Windows with reflective borders. With infinite movement. How is the best practice in chipmunk?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Bouncing

Post by slembcke »

If you want things to have a perfect bounce, you need to set the shape.e (elasticity) of all your shapes to 1.0 and the shape.u (friction) of them to 0.0.

Take a look at how the Bounce demo does it: http://code.google.com/p/chipmunk-physi ... o/Bounce.c
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
martin.knotek
Posts: 2
Joined: Fri Feb 05, 2010 9:22 am
Contact:

Re: Bouncing

Post by martin.knotek »

And how is possible move with items without gravitation?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Bouncing

Post by slembcke »

You can apply forces to the the cpBody objects. You can also set their velocity directly if you just want to start them off moving in a certain direction.
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 29 guests