mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-16 06:30:05 +00:00
fix issue introduced in previous commit, related to
btMultiBodyConstraintSolver friction/penetration handling
This commit is contained in:
parent
0b017b0f53
commit
0c874aa43a
@ -442,7 +442,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
|
|||||||
distance = cp.getDistance()+infoGlobal.m_linearSlop;
|
distance = cp.getDistance()+infoGlobal.m_linearSlop;
|
||||||
} else
|
} 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 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
|
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;
|
positionalError = 0;
|
||||||
velocityError -= distance / infoGlobal.m_timeStep;
|
velocityError -= distance / infoGlobal.m_timeStep;
|
||||||
|
|
||||||
} else
|
} 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;
|
btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv;
|
||||||
|
Loading…
Reference in New Issue
Block a user