I use standard Box2D ContactListenerto listen for collision events. I want to calculate the impact force of a collision between Bodies.
I read many different descriptions of how people calculate it. Some use callbacks preSolve, others use postSolve. Some use Manifold, others use ContactImpulse. Some take only the first point normalImpulse + tangentImpulse, others take the sum of all points and others, again take the maximum. Some people completely ignore tangentImpulses ...
I can not solve this problem. Sometimes I get only pulses in postSolve, and pulses in preSolveare equal to 0. Sometimes it's the other way around. Sometimes I get ridiculously high values (e.g., from 1E15 to 1E30), and sometimes they are ridiculously low (say -1E15 to -1E30). I even had a case that one of the impulses was NaN(Not a Number).
Is there anyone who can explain to me how to solve this problem and maybe explain how to interpret these impulses? Or maybe point me to any open source game that uses Box2D, and also need to calculate the impact on any damage system?
source
share