I am programming a breakout/arkanoid like game that uses bullet for collision detection and physics. To keep the balls in two dimensions I use the method described in the Wiki (Code Snippets). In short, I create a null body, attach the ball bodies and add a 6 DOF constraint for every ball. In that constraint I lock the third axis to keep the balls in one xy-plane.
This method works only when:
- the local inertia of the balls is a zero vector
- the restitution of the colliding bodies is set to something like 1
- the friction of the colliding bodies ist set to 0
Another thing... I think sometimes it's difficult to integrate bullet into the game logic. For example when a ball collides with a brick, the brick have to disappear. I try to do this in the collision processed callback (BTW at the moment there is no extern declaration for gCollisionProcessedCallback in any of the header files). Of course, when I remove the brick body from the world at this point of the collision detection, it is removed before the physics algorithms have a chance to calculate the new velocity of the ball. Hence, the ball continue to move in the same direction as before. How is it possible to let the ball collide correctly with a brick and to remove the brick from the world?