improve dynamic friction

This commit is contained in:
Xuchen Han
2019-08-10 11:11:18 -07:00
parent fb6612c0be
commit fa5741d07e
7 changed files with 245 additions and 378 deletions

View File

@@ -36,17 +36,17 @@ void btDeformableBodySolver::solveConstraints(float solverdt)
// add constraints to the solver
setConstraints();
m_objective->computeResidual(solverdt, m_residual);
m_objective->projectFriction(m_residual);
m_objective->applyDynamicFriction(m_residual);
computeStep(m_dv, m_residual);
updateVelocity();
}
void btDeformableBodySolver::computeStep(TVStack& dv, const TVStack& residual)
{
btScalar tolerance = std::numeric_limits<float>::epsilon()* 1024 * m_objective->computeNorm(residual);
btScalar tolerance = std::numeric_limits<float>::epsilon() * m_objective->computeNorm(residual);
m_cg.solve(*m_objective, dv, residual, tolerance);
}
@@ -76,7 +76,7 @@ void btDeformableBodySolver::setConstraints()
{
BT_PROFILE("setConstraint");
m_objective->setConstraints();
for (int i = 0; i < 1; ++i)
for (int i = 0; i < 10; ++i)
{
m_objective->projection.update();
m_objective->enforceConstraint(m_dv);