[SOLVED] Pinball game - problem with dynamic collisions

Hi everyone,

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. :slight_smile:

1 Like

@britzl Thank you very much !

@britzl Sorry if this is a trivial question. But how can I set this flag to TRUE ?

It is not exposed in Lua yet. If you want to enabled it you need to modify the engine code and build your own version of the engine.

1 Like

I have similar problem.
Has this problem been solved somehow in the new version ?

Yes it has. Check the properties for the dynamic collision object:


I don’t know if I’m doing something wrong, but the ball continues to run away through the walls.
I set all the walls to “bullet”

i think your ball should be the bullet, not the walls :wink:


OK, I will check. thank you !

Now " bullet" has only the ball set.
However, it continues to go through walls :confused: