Pong!

icek
Posts: 14
Joined: Thu May 15, 2008 6:09 pm

Pong!

Post by icek »

Hi I'm trying to code game like pong and i want to use bullet for ball physics. I got it working, but when ball hits the wall and bounce, he slows down. 
Is there some parameter or something that i could set up to make ball bounce with the same speed? 
chunky
Posts: 145
Joined: Tue Oct 30, 2007 9:23 pm

Re: Pong!

Post by chunky »

Set the friction on the two surfaces to zero, and the restitution to 1.0. Although with that, there's almost no energy being lost in your system, so if you're adding energy to the system at any point, then you're looking at a unstable situation with an unhappy ending.

Gary (-;
icek
Posts: 14
Joined: Thu May 15, 2008 6:09 pm

Re: Pong!

Post by icek »

thx, works great. Now i'm having different troubles :-) I'm using one dynamic body and some kynematic bodies. I have read some posts here about setting position of kynematic body, i see there is more ways to do that, which is the best? body::setWorldTransform or setting motionState? I tried both ways and some times dynamic body does not collide with kynematic body, i don't know why this is happening....
icek
Posts: 14
Joined: Thu May 15, 2008 6:09 pm

Re: Pong!

Post by icek »

Problem sovled... Body->setActivationState(DISABLE_DEACTIVATION);