I tracked the problem down to function
get_limit_motor_info2
specifically the section
Code: Select all
if (powered)
{
info->cfm[srow] = limot->m_normalCFM;
if(!limit)
{
btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity;
btScalar mot_fact = getMotorFactor( limot->m_currentPosition,
limot->m_loLimit,
limot->m_hiLimit,
tag_vel,
info->fps * limot->m_stopERP);
info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity;
info->m_lowerLimit[srow] = -limot->m_maxMotorForce;
info->m_upperLimit[srow] = limot->m_maxMotorForce;
}
}
taking out the if doesn't work because it messes up the lower and upper limits.
Just below this section is another section that begins with:
Code: Select all
if(limit)
{
Code: Select all
if(powered)
Code: Select all
if (powered)
{
info->cfm[srow] = 0.0f;
btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity;
btScalar mot_fact = getMotorFactor( limot->m_currentPosition,
limot->m_loLimit,
limot->m_hiLimit,
tag_vel,
info->fps * info->erp);
btScalar error = mot_fact * limot->m_targetVelocity;
if (btFabs(error) > btFabs(info->m_constraintError[srow]))
{
info->m_constraintError[srow] = error;
}
if(!limit)
{
info->m_lowerLimit[srow] = -limot->m_maxMotorForce;
info->m_upperLimit[srow] = limot->m_maxMotorForce;
}
else
{
if (-limot->m_maxMotorForce < info->m_lowerLimit[srow])
info->m_lowerLimit[srow] = -limot->m_maxMotorForce;
if (limot->m_maxMotorForce > info->m_upperLimit[srow])
info->m_upperLimit[srow] = limot->m_maxMotorForce;
}
}
I'm not sure if this is the right solution, but it certainly works for me.
If this seems correct, I'll post it as a patch. If not, I can change it to work as need be.