Bouncing

Official forum for the Chipmunk Physics Library.

Bouncing

Postby martin.knotek on Fri Feb 05, 2010 9:25 am

Hi, I’m trying create ball in Windows with reflective borders. With infinite movement. How is the best practice in chipmunk?
martin.knotek
 
Posts: 2
Joined: Fri Feb 05, 2010 9:22 am

Re: Bouncing

Postby slembcke on Fri Feb 05, 2010 10:54 am

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
I'm the guy that wrote Chipmunk. Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 1485
Joined: Tue Aug 14, 2007 7:13 pm

Re: Bouncing

Postby martin.knotek on Sun Feb 07, 2010 4:12 pm

And how is possible move with items without gravitation?
martin.knotek
 
Posts: 2
Joined: Fri Feb 05, 2010 9:22 am

Re: Bouncing

Postby slembcke on Sun Feb 07, 2010 4:20 pm

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.
I'm the guy that wrote Chipmunk. Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 1485
Joined: Tue Aug 14, 2007 7:13 pm


Return to Chipmunk Physics

Who is online

Users browsing this forum: AngelFeathers, Google [Bot], Yahoo [Bot] and 1 guest

cron