Stop resitution for resting contact, after n frames (can be controlled by btContactSolverInfo.m_restingContactRestitutionThreshold
Thanks Jan Bender for bringing this up
This commit is contained in:
@@ -718,11 +718,19 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
//solverConstraint.m_penetration = cp.getDistance();
|
||||
|
||||
solverConstraint.m_friction = cp.m_combinedFriction;
|
||||
solverConstraint.m_restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution);
|
||||
if (solverConstraint.m_restitution <= btScalar(0.))
|
||||
|
||||
|
||||
if (cp.m_lifeTime>infoGlobal.m_restingContactRestitutionThreshold)
|
||||
{
|
||||
solverConstraint.m_restitution = 0.f;
|
||||
};
|
||||
} else
|
||||
{
|
||||
solverConstraint.m_restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution);
|
||||
if (solverConstraint.m_restitution <= btScalar(0.))
|
||||
{
|
||||
solverConstraint.m_restitution = 0.f;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
btScalar penVel = -solverConstraint.m_penetration/infoGlobal.m_timeStep;
|
||||
@@ -1220,12 +1228,17 @@ void btSequentialImpulseConstraintSolver::prepareConstraints(btPersistentManifol
|
||||
|
||||
cpd->m_penetration = cp.getDistance();///btScalar(info.m_numIterations);
|
||||
cpd->m_friction = cp.m_combinedFriction;
|
||||
cpd->m_restitution = restitutionCurve(rel_vel, combinedRestitution);
|
||||
if (cpd->m_restitution <= btScalar(0.))
|
||||
if (cp.m_lifeTime>info.m_restingContactRestitutionThreshold)
|
||||
{
|
||||
cpd->m_restitution = btScalar(0.0);
|
||||
|
||||
};
|
||||
cpd->m_restitution = 0.f;
|
||||
} else
|
||||
{
|
||||
cpd->m_restitution = restitutionCurve(rel_vel, combinedRestitution);
|
||||
if (cpd->m_restitution <= btScalar(0.))
|
||||
{
|
||||
cpd->m_restitution = btScalar(0.0);
|
||||
};
|
||||
}
|
||||
|
||||
//restitution and penetration work in same direction so
|
||||
//rel_vel
|
||||
|
||||
Reference in New Issue
Block a user