hqm
hqm

Reputation: 73

How do I compute the force between two contacting bodies in box2d / jbox2d?

I am building a simulated robot hand using jbox2d (a port of box2d to Java). I have a Body which is the hand, and I would like to know what forces are on the hand when it is touching other bodies.

I know I can get the ContactList, but I don't know how to compute what the forces are between the hand and the contacting bodies.

Ideally I would like to get the force vector between the hand and each contacting body. Then I can look at them individually, or sum them to get the total forces acting on the hand.

Upvotes: 0

Views: 186

Answers (1)

Pavel
Pavel

Reputation: 2554

Set contact listener, and override method PostSolve. Second parameter contains normal and tangent impulses. To convert impulse into force, divide it by time step.

F = p / dt

Upvotes: 1

Related Questions