# Calculate forces and torques in joints

## Calculate forces and torques in joints

Hello,

I would like to export forces and torques from my joints. Is there a way to do that? I thought this should be possible as I can apply also forces and torques to my rigid bodies.
Thank you very much!

4 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

Hi there, Lowy

I'm afraid that the Havok constraint solver doesn't really work in such a way that the forces and torques from individual joints are readily available. You could try the following pseudocode though, which should give you the impulse applied for the 'limited angle' component of a limited hinge:

hkpLimitedHingeConstraintData* data = ...;
hkpConstraintInstance* instance = ...;

hkpLimitedHingeConstraintData::Runtime* runtime = data->getRuntime( instance->getRuntime() );
hkpSolverResult limitResult = runtime->m_solverResults[SOLVER_RESULT_LIMIT];
hkReal impulse = limitResult.getImpulseApplied();

You might need to sum all the SOLVER_RESULT_* components to give you an overall impulse.

What are you using the forces and torques for? Perhaps there might be another way to get what you are using them to find.

Patrick Developer Support Engineer Havok www.havok.com

Hey Patrick,

the forces and torques are interesting for us, as we are rebuilding the movement of a sportsmen during his pitching. The idea is to get the forces and torques in the joint in order so see when the arm joint get injured. In the same time this would help to find a movement where the arm has the less stress possible on him.
Is Havok not calculating with forces in its solver? Do you have a documentation about your solver, or is this confidential?
Thank you,

Clemens

Hi Clemens

Technically, we don't directly calculate forces; but we do calculate individual impulses (divide by deltaT for forces and torques) for each degree-of-freedom component of the constraint. You can read those impulses with the code snippet I gave you. Were you able to get that to work?

As to the solver documentation, I'm afraid the docs that come with the SDK and content tools are what you get - plus whatever you can glean from the headers.

Let me know if you have further questions.

Patrick Developer Support Engineer Havok www.havok.com