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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user