Change constraint solver threshold-based termination condition on residual of velocity threshold, not on residual of impulse threshold.

This avoids issues with systems with large mass ratios.

Test: add this to BasicDemo/BasicExample.cpp in initPhysics

	m_dynamicsWorld->getSolverInfo().m_numIterations = 1000;
	m_dynamicsWorld->getSolverInfo().m_leastSquaresResidualThreshold = 1e-4;
This commit is contained in:
Erwin Coumans
2018-07-22 11:30:16 +02:00
parent f8cc33f3a3
commit b5495e789d
4 changed files with 37 additions and 32 deletions

View File

@@ -274,7 +274,8 @@ btScalar btMultiBodyConstraintSolver::resolveSingleConstraintRowGeneric(const bt
{
bodyB->internalApplyImpulse(c.m_contactNormal2*bodyB->internalGetInvMass(), c.m_angularComponentB, deltaImpulse);
}
return deltaImpulse;
btScalar deltaVel =deltaImpulse/c.m_jacDiagABInv;
return deltaVel;
}
@@ -453,7 +454,8 @@ btScalar btMultiBodyConstraintSolver::resolveConeFrictionConstraintRows(const bt
bodyB->internalApplyImpulse(cB.m_contactNormal2*bodyB->internalGetInvMass(),cB.m_angularComponentB,deltaImpulseB);
}
return deltaImpulseA+deltaImpulseB;
btScalar deltaVel =deltaImpulseA/cA.m_jacDiagABInv+deltaImpulseB/cB.m_jacDiagABInv;
return deltaVel;
}