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
@ -441,9 +441,12 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
|
|||||||
{
|
{
|
||||||
distance = cp.getDistance()+infoGlobal.m_linearSlop;
|
distance = cp.getDistance()+infoGlobal.m_linearSlop;
|
||||||
} else
|
} else
|
||||||
|
{
|
||||||
|
if (cp.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR)
|
||||||
{
|
{
|
||||||
distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal);
|
distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
btScalar rel_vel = 0.f;
|
btScalar rel_vel = 0.f;
|
||||||
@ -541,18 +544,15 @@ 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;
|
||||||
btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv;
|
btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv;
|
||||||
|
Loading…
Reference in New Issue
Block a user