Direction of Collision Normals Question

Hello,

I've ran into a little hurdle and hope someone can help. What I'm trying to do is take a collision and "blow it up" by applying impulses to both bodies based off of the collision normal (one body gets the normal vector multiplied by some large positive value, the other body gets the same impulse but negative). This works perfect 90% of the time. For the other 10%, the normal vector is inverted, so the impulses actually smoosh the bodies together rather than blowing them up.

I'm using this procedure to make a user controlled body jump. It's works nice because the body can jump off of any body it's touching, and jump in the correct direction (not always straight up). I noticed this strange behavior when the body wouldn't jump off of certain objects (it would actually stick to them if I held jump down - the wrong-direction-impulse was being applied with each iteration).

I investigated all of the contact related classes but couldn't find anything to explain this... I was hoping to find some variable that was always 1 or -1 that I could multiply the normal by... it's not that simple I guess.

Thanks!
The normal should point from shape1 to shape2 as defined in b2Contact. Let me know if this is not the case.

This convention is clearer in 2.0. I'll update the manual too.
Erin,

That set me on the right course. I was applying the impulses to the player-body and the "other" variable in the ContactNode. Now I'm using the m_shape# variables and it seems to work perfect. Thanks for the tip.

Original thread: https://box2d.org/forum/viewtopic.php?t=351