I need to know the overall impact strength of a rigidbody, to do some customized reactions
I could compare previous pos with current but I wouldn't get realistic numbers and position does not matter much.
...what's the fastest way?
You want to know if the object should break or something, depending on how fast/heavy it was struck?
Search for the following string in the manual:
"The pre-solve event is also a good place to determine the point state and the approach velocity of collisions"
I think you could use that to get the information on the other body involved in the collision, and thence how heavy it is and how fast (relatively) it was moving, then you can decide how it would affect your object.
You can get the impulse from pre-solve and post-solve events (it's stored in the manifold).
Inside maifold I see 5 properties only:
m_localPlaneNormal
m_localPoint
m_pointCount
m_points
m_type
Could you please be more explicit?
I'm new to box2d 🙁
Why do I need both pre and a post contact?
Should I use the old manifold in some way?
sorry i'm a real newbie 😐
You don't have to use both, use what works for you - check for something before (pre) or after (post) collisions.
If you're looking for the force of impact, I believe you should get the impulse from the preContact event.
As for the manifold, use the oldManifold - which is the last manifold before the collision.
The other manifold, contact.GetManifold(), will probably return the same result in the preContact event.
If for some reason you need the impulse when there is contact, use contact.GetManifold().
I consider myself pretty new to Box2D too, so no worries 😉