Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect collision but do not collide in box2d?

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!

like image 469
B.S. Avatar asked Jun 16 '12 09:06

B.S.


1 Answers

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.

like image 146
iforce2d Avatar answered Sep 18 '22 18:09

iforce2d