This project has moved and is read-only. For the latest updates, please go here.

Strange thing in postsolve

Topics: Developer Forum, Project Management Forum
Jan 5, 2011 at 1:48 PM

I'm using a delegate of the World.PostSolve class, and I'm facing a strange issue with FPE3.2

Each world's step I create a cache of all the contacts for processing them later (inspired from crashlander's suggestion), then I calculate the max impulse and check if the impulse is high enough to break/destroy some elements. In my game I have several characters which are basically a box for the body and a circle for the feet.

The problem is, I'm testing ho well the maxImpulse calculations work, so I'm throwing a huge, heavy box from a high height above one of the characters (thinking about the roadrunner and a failed wyle e. coyote trap), and when the box hits the character, the maxImpulse triggers the "dead" of the character (because the impulse applied to the feet against the floor after the box crushes the character), BUT by some reason, all the other characters are crushed too (their feet suffer a big maxImpulse too). The only characters that are not destroyed are the ones that are not touching the floor (without contact, it is).

Jan 5, 2011 at 2:00 PM

OK, I just noticed something that seems to be a bug.

Debugging the postsolve delegate, I just realized something: The ContactConstraint.Points[] values are overwritten for every contact, each time the postsolve is called. This way I have always the "latest" ContactConstraint.Points data (the rest of the ContactConstraint information is correct), which in this case is the heavy box hitting the floor, then I check the max impulse and every character thinks that is being crushed as the ContactConstraint.Points information says that the hit is huge.

Jan 5, 2011 at 3:09 PM
Edited Jan 5, 2011 at 3:45 PM

Just to clearify: After each World.Step(), all the ContactConstraint.Points[] seem to have the same values.


Edit: Nope, not always happens the above, now I'm confused. It seems to happen after the box has collided against the floor (now I realized that even if the box don't hit the character, it still "crushes" everyone)

Edit2: Now I'm realizing that only the points are the same for the "feet" shape (the circle) after the box hits the floor (without touching any character). It seems a bug in my game rather than in the engine, but still.. I have no idea what's happening here.

Jan 6, 2011 at 11:36 PM

Well, I've never seen this issue before and I'm inclined to think the problem lies in your game. Note that in FPE 3.2 you can use the AfterCollision delegate to get the amount of force applied between bodies in a collision.