Problem with moving ball (sphere shape) [SOLVED]

ProtoZoo

09-04-2007 21:52:49

I've got a problem with OgreNewt and could not find a proper solution. I want a sphere to act like a pong-ball.

I want to ignore the movement on the y-axis. To do so, I updated the y position of the body manually inside the bodies force callback.

The result is that the ball starts wobbling up and down.

The body should also travel at a constant speed. I set the linear damping to zero and added the following to the contact callback of the sphere:

1. Get the current velocity.
2. Normalize the velocity vector.
3. Multiply it with the constant velocity.
4. Update the bodies velocity with setVelocity

That works on all contacts but the ball slows down while moving. So i tried to do the same inside the force callback but the ball slows down faster than before.

Is there any 'easy' solution to that problem???

Thanks in advance!