fix issue introduced in previous commit, related to

btMultiBodyConstraintSolver friction/penetration handling
This commit is contained in:
Erwin Coumans 2017-03-20 19:38:59 -07:00
parent 0b017b0f53
commit 0c874aa43a

View File

@ -442,7 +442,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
distance = cp.getDistance()+infoGlobal.m_linearSlop;
} else
{
distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal);
if (cp.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR)
{
distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal);
}
}
@ -541,17 +544,14 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
btScalar positionalError = 0.f;
btScalar velocityError = restitution - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction
if (distance>0 && !isFriction)
if (distance>0)
{
positionalError = 0;
velocityError -= distance / infoGlobal.m_timeStep;
} else
{
if (cp.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR)
{
positionalError = -distance * erp/infoGlobal.m_timeStep;
}
positionalError = -distance * erp/infoGlobal.m_timeStep;
}
btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv;