fix for btGeneric6DofConstraint, when the btRotationalLimitMotor goes over PI or under -PI.
See http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=5046&p=27113#p27113 Thanks zlash for the fix/report and Flix for the reminder.
This commit is contained in:
@@ -130,12 +130,20 @@ int btRotationalLimitMotor::testLimitValue(btScalar test_value)
|
|||||||
{
|
{
|
||||||
m_currentLimit = 1;//low limit violation
|
m_currentLimit = 1;//low limit violation
|
||||||
m_currentLimitError = test_value - m_loLimit;
|
m_currentLimitError = test_value - m_loLimit;
|
||||||
|
if(m_currentLimitError>SIMD_PI)
|
||||||
|
m_currentLimitError-=SIMD_2_PI;
|
||||||
|
else if(m_currentLimitError<-SIMD_PI)
|
||||||
|
m_currentLimitError+=SIMD_2_PI;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (test_value> m_hiLimit)
|
else if (test_value> m_hiLimit)
|
||||||
{
|
{
|
||||||
m_currentLimit = 2;//High limit violation
|
m_currentLimit = 2;//High limit violation
|
||||||
m_currentLimitError = test_value - m_hiLimit;
|
m_currentLimitError = test_value - m_hiLimit;
|
||||||
|
if(m_currentLimitError>SIMD_PI)
|
||||||
|
m_currentLimitError-=SIMD_2_PI;
|
||||||
|
else if(m_currentLimitError<-SIMD_PI)
|
||||||
|
m_currentLimitError+=SIMD_2_PI;
|
||||||
return 2;
|
return 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1067,4 +1075,4 @@ void btGeneric6DofConstraint::setAxis(const btVector3& axis1,const btVector3& ax
|
|||||||
m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW;
|
m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW;
|
||||||
|
|
||||||
calculateTransforms();
|
calculateTransforms();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user