androidbox2dandengine

Bodies colliding multiple times in single contact [AndEngine]


In the game I'm developing, I have bodies (from the box2d extension) flying around. Some of these bodies collide with each other. The problem is that for every single contact the beginContact method in contactListener get called twice (at least).

Both the bodies that are colliding have the maximum elasticity of 1.

Is there a way to make the collision happen exactly once, i.e., have beginContact called only once for every contact?


Solution

  • Turns out I had created two identical bodies behind one another by mistake. Obviously, this caused the beginContact method to be called twice for each collision.

    This must be one of the sneakiest bugs I have ever had.