Sensors not detecting collisions with high velocity shapes

Hi.

I'm developing a billiards game in which I use sensors to check if a ball has reached the pocket and should be removed. Generally, it works fine but there's a problem when a ball is very close to the sensor and is shot towards it with a high velocity. Collision with the sensor is not detected. What's odd is that just behind the sensor is a static body which the ball bounces off correctly ( so I would assume Box2d is doing CCD then and at that point the ball is over the sensor so it should be detected too).

The sensors are set as static bodies (tried kinematic bodies as well) with no mass and density set to 0. Balls are set as bullets.

I tried tampering with b2Settings as well as setting a lower step for the simulation. At some point when changing the step the sensors start to work with high velocity bodies but, due to great amount of graphics, the whole game runs slower and I cannot have that in a billiards game.

Any ideas on how to solve this would be greatly appreciated.

Also, if You need additional information on the issue, please write it here and I'll post what's needed.
Sensors are not involved in CCD, so there will be no contact recorded. Either make the sensors nice and big, or make the pocket a static object and extend the contact listener to check for every collision and report ball/pocket collisions.
Thanks a lot, You gave me an idea on how to solve this 🙂

Making the sensors bigger didn't have much effect. Besides, it messed pocketing the balls at low velocities.

I set id's in userData of the bodies which surround the pocket and I check for that id in my CustomContactListener as well as if the body is a sensor. This way sensors detect my low velocity bodies and the "walls" of the pocket detect everything else. Works like a charm.
Ok, I don't want to create a new topic so I'll continue in this thread.

I have another problem which is related to the previous one. Now I can detect a body at high velocity hitting a wall surrounding the pocket. There are cases in which I don't want to destroy the ball's body at this point. Instead, I want it to bounce off the wall and I want to disable it's collisions with other balls. I try to do that using collision filtering and generally it works, but there are times when the ball bounces off and still has a high speed. If there's another ball near enough, it gets hit before the collision filtering is applied.

My guess is that when the ball bounces off the wall and I set the filtering (using maskbits) it isn't applied until the next step of the simulation. And a nearby ball gets hit in the same step in which I set the filtering. Am I right?

Any ideas on how to solve this?

Original thread: https://box2d.org/forum/viewtopic.php?t=4969