The original code in btMultiBodyJointLimitConstraint::createConstraintRows:
Code: Select all
// row 0: the lower bound
setPosition(0, m_bodyA->getJointPos(m_linkA) - m_lowerBound);
// row 1: the upper bound
setPosition(1, m_upperBound - m_bodyA->getJointPos(m_linkA));
...
if (penetration>0)
{
...
Code: Select all
// row 0: the lower bound
btScalar pos0 = m_bodyA->getJointPos(m_linkA) - m_lowerBound;
if (pos0>0) pos0 = 0.f;
setPosition(0, pos0);
// row 1: the upper bound
btScalar pos1 = m_upperBound - m_bodyA->getJointPos(m_linkA);
if (pos1>0) pos1 = 0.f;
setPosition(1, pos1);
...
if (penetration<0)
{
...