Getting data from limited hinge constraint

Getting data from limited hinge constraint

I was wondering if there was a way once you set the hkpLimitedHingeConstraintData using setBodyInSpace(pivotA, pivotB, axisA, axisB, axisAPerp, axisBPerp) to retrieve those values back from the limited hinge data.

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

Hi there Nick

Yes, there is indeed - try these lines of code:

hkVector4* accessConstraintPivotA (const hkpConstraintInstance* constraint)
{
hkpConstraintData *constraintData = constraint->getDataRw();
hkpLimitedHingeConstraintData* hConstraint = static_cast (constraintData);
return &hConstraint->m_atoms.m_transforms.m_transformA.getTranslation();
}

Or you could just return the m_transformA and m_transformB of m_transforms; each one has the following structure:

column 0: axisA (normalized)
column 1: axisAPerp (normalized)
column 2: crossproduct(axisA, axisAPerp)
column 3: pivotA

I hope this works for you; get back to me if you have questions.

Patrick Developer Support Engineer Havok www.havok.com

Login to leave a comment.