Feb 14, 2014 at 2:38 AM
Edited Feb 14, 2014 at 7:04 AM
I have two objects, when they collide with each other I return false in the Fixture.OnCollision event, but call a couple of functions here, I want to calculate a theoretical impulse (what would it have been if we did return true).
What I was doing before (when my two objects were colliding) was in PostSolve calculate:
float maxImpulse = 0.0f;
int count = contact.Manifold.PointCount;
for (int i = 0; i < count; ++i)
maxImpulse = Math.Max(maxImpulse, impulse.points[i].normalImpulse);
The problem is that now that I am cancelling the collision I can no longer use PostSolve which has access to the calculated impulse. What I would like to do is somehow calculate a theoretical impulse, what would it have been if I had allowed these objects to
collide. Any ideas on how to do this?
Edit: Maybe I need to start up another physics simulation and run the collision there, then I can see what the impulse would have been if they did collide. Seems like a lot of overhead though.
Edit: I'm currently just trying to calculate some sort of impulse based on the velocity and mass but it is very over simplified and wont take into account any form of glancing blows.