maaboo
maaboo

Reputation: 137

Box2d impact force vector

I need to get a vector from the one of two colliding bodies to apply it elsewhere.

As i see in examples and a lot of google-fu there are only strength calculation, not a vector.

I can get only impulse->normalImpulses[0] and impulse->tangentImpulses[0].

And the PostSolve b2ContactImpulse holds the strange float (impulse is a vector AFAIR).

I'm really confused, please help!

Upvotes: 1

Views: 1207

Answers (2)

Slav
Slav

Reputation: 3

In AS3 version, Box2D has one important thing:
You cann't do anything with your bodies when they are in contact;
Do your staff overriding EndContact() method. You can Google for examples, hope It would help.

Upvotes: 0

iforce2d
iforce2d

Reputation: 8272

normalImpulse is the magnitude of the correcting impulse applied to push the two bodies apart when they collide. This is in the direction of the contact normal.

tangentImpulse is the magnitude of the impulse applied to simulate friction between the two colliding fixtures, and this is perpendicular to the contact normal.

You can put these together to get the overall impulse applied. I'm not sure which way the tangent faces in relation to the normal but in 2D there are only two possibilities.

Upvotes: 2

Related Questions