Fix issue with cone friction, we had to accumulate squared residual, not just residual.

This fixes issue 1473, thanks to Avik De for reporting the issue.
This commit is contained in:
erwincoumans
2017-12-14 10:51:43 -08:00
parent e0bb359804
commit 5ab6a0ad43

View File

@@ -114,7 +114,14 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl
frictionConstraint.m_upperLimit = frictionConstraint.m_friction*totalImpulse;
frictionConstraintB.m_lowerLimit = -(frictionConstraintB.m_friction*totalImpulse);
frictionConstraintB.m_upperLimit = frictionConstraintB.m_friction*totalImpulse;
leastSquaredResidual += resolveConeFrictionConstraintRows(frictionConstraint, frictionConstraintB);
btScalar residual = resolveConeFrictionConstraintRows(frictionConstraint, frictionConstraintB);
leastSquaredResidual += residual*residual;
if (frictionConstraintB.m_multiBodyA)
frictionConstraintB.m_multiBodyA->setPosUpdated(false);
if (frictionConstraintB.m_multiBodyB)
frictionConstraintB.m_multiBodyB->setPosUpdated(false);
if (frictionConstraint.m_multiBodyA)
frictionConstraint.m_multiBodyA->setPosUpdated(false);
if (frictionConstraint.m_multiBodyB)