I’m working on a flipper and I’m having problems with dynamic collisions:
a. when the ball reaches a higher speed, the ball flies through the wall (video example)
b. sometimes even at low speed the ball flies through the paddles
Has anyone met with a similar problem ? What could be the problem?
The problem is that the physics is updated once per frame and if the ball is on one side of the collision shape in one frame and then moves at such a speed that it at the next frame is on the other side, then no collision is detected.
One solution is to use a kinematic collisions and raycasts to detect this, but it means resolving all collisions on your own. Another solutions if to make items thicker or restrict speed. And the third and most correct solution is to use the Bullet property in Box2D to check collisions multiple times in each frame. This property is not yet exposed, but there is a GitHub issue that you can vote on:
And it might be a great next feature to encourage @otsakir to take a look at since he’s currently doing some other improvements to physics.