Collision filtering problems

I've posted this in my previous thread but got no replies so I'm creating a new topic.

I'm developing a billiards game. 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?
Yeah. There are some operations you can do during events. If you want the body to reject all collisions, mark the body as dead inside userdata, and then use that to set b2Contact.Disable in subsequent events. (this method may not be available in 2.0, I forget).
disabling contact was introduced in 2.1.
It is notable for providing the ability to make one way platforms.
You were right, there is a setEnabled() method in b2Contact. Works great. Thanks a lot 🙂

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