I'm trying to implement Box2d's ContactListener interface. The method called when a contact happens receives a Contact object. This object then provides getFixtureA
and getFixtureB
getters.
Is there a rule, that says which fixture is assigned to A and which to B or do I have to check all combinations, as in:
I have bodies X, Y, Z and want to check if X and Y collided. Do I have to always check if (A == X && B == Y) || (A == Y && B == X)
or is one of the two sufficient?
(A is contact.getFixtureA(); and B is contact.getFixtureB();)
You would have to check both possibilities, Box2D provides no specific ordering.
As irresistable force says, there would be no logical ordering for fixtures in a contact:
If they were ordered somehow, how would they be ordered?