How to detect if body collides other body but do not react on this collision.
By default i - detect collision and bodies collide.
If i set fixtureDef filter - bodies do not collide but i can not detect collision.
Help please!
How to detect if body collides other body but do not react on this collision.
By default i - detect collision and bodies collide.
If i set fixtureDef filter - bodies do not collide but i can not detect collision.
Help please!
What you want here is a sensor fixture on a body. From the box2d manual:
You can set a fixture as a sensor and then write it into your contact listener. If a fixture has its sensor flag set to true, it will provide collision data without physically simulating the collision (ie will allow you to test for overlap between it any any other colliding fixture.)
This is a helpful tutorial on how to get started using sensors Ray Wenderlich sensor tutorial
If the fixture never needs to collide with anything you could make it a sensor. If you need it to collide with some things but not others you could do contact->SetEnabled(false) in the PreSolve of the collision listener, depending on what it collided with.