From 16cc5665defe1ce8e665518d7fcf3248baf387aa Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Fri, 1 Jul 2011 21:51:38 +0000 Subject: [PATCH] fix in the breaking constraints feature --- .../btSequentialImpulseConstraintSolver.cpp | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp index c05e22fb1..a5e17f471 100644 --- a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp +++ b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp @@ -875,22 +875,21 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol info2.m_numIterations = infoGlobal.m_numIterations; constraints[i]->getInfo2(&info2); - if (currentConstraintRow->m_upperLimit>constraints[i]->getBreakingImpulseThreshold()) - { - currentConstraintRow->m_upperLimit = constraints[i]->getBreakingImpulseThreshold(); - } - - if (currentConstraintRow->m_lowerLimit<-constraints[i]->getBreakingImpulseThreshold()) - { - currentConstraintRow->m_lowerLimit = -constraints[i]->getBreakingImpulseThreshold(); - } - - - ///finalize the constraint setup for ( j=0;j=constraints[i]->getBreakingImpulseThreshold()) + { + solverConstraint.m_upperLimit = constraints[i]->getBreakingImpulseThreshold(); + } + + if (solverConstraint.m_lowerLimit<=-constraints[i]->getBreakingImpulseThreshold()) + { + solverConstraint.m_lowerLimit = -constraints[i]->getBreakingImpulseThreshold(); + } + solverConstraint.m_originalContactPoint = constraint; { @@ -1172,7 +1171,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyFinish(btCo const btSolverConstraint& solverConstr = m_tmpSolverNonContactConstraintPool[j]; btTypedConstraint* constr = (btTypedConstraint*)solverConstr.m_originalContactPoint; constr->internalSetAppliedImpulse(solverConstr.m_appliedImpulse); - if (solverConstr.m_appliedImpulse>constr->getBreakingImpulseThreshold()) + if (btFabs(solverConstr.m_appliedImpulse)>=constr->getBreakingImpulseThreshold()) { constr->setEnabled(false); }