btHingeConstraint solver changed to improve stability and allow to fix joint

This commit is contained in:
rponom
2008-09-11 20:28:05 +00:00
parent 350e2e0393
commit b0d6ba845e

View File

@@ -241,15 +241,18 @@ void btHingeConstraint::buildJacobian()
m_solveLimit = false; m_solveLimit = false;
m_accLimitImpulse = btScalar(0.); m_accLimitImpulse = btScalar(0.);
if (m_lowerLimit < m_upperLimit) // if (m_lowerLimit < m_upperLimit)
if (m_lowerLimit <= m_upperLimit)
{ {
if (hingeAngle <= m_lowerLimit*m_limitSoftness) // if (hingeAngle <= m_lowerLimit*m_limitSoftness)
if (hingeAngle <= m_lowerLimit)
{ {
m_correction = (m_lowerLimit - hingeAngle); m_correction = (m_lowerLimit - hingeAngle);
m_limitSign = 1.0f; m_limitSign = 1.0f;
m_solveLimit = true; m_solveLimit = true;
} }
else if (hingeAngle >= m_upperLimit*m_limitSoftness) // else if (hingeAngle >= m_upperLimit*m_limitSoftness)
else if (hingeAngle >= m_upperLimit)
{ {
m_correction = m_upperLimit - hingeAngle; m_correction = m_upperLimit - hingeAngle;
m_limitSign = -1.0f; m_limitSign = -1.0f;