build islands once and process islands arbitrary number of times in update constraints

This commit is contained in:
Xuchen Han
2019-08-13 14:37:45 -07:00
parent 9e6e571732
commit 07bf736aeb
7 changed files with 29 additions and 9 deletions

View File

@@ -143,6 +143,8 @@ void btDeformableBackwardEulerObjective::setConstraints()
{
// build islands for multibody solve
m_world->btMultiBodyDynamicsWorld::buildIslands();
// for repeated constraint solve, splitIslands has to be set to true
m_world->setSplitIslands(true);
projection.setConstraints();
}

View File

@@ -19,7 +19,7 @@
btDeformableBodySolver::btDeformableBodySolver()
: m_numNodes(0)
, m_cg(10)
, m_contact_iterations(10)
, m_contact_iterations(5)
{
m_objective = new btDeformableBackwardEulerObjective(m_softBodySet, m_backupVelocity);
}

View File

@@ -51,9 +51,11 @@ static btVector3 generateUnitOrthogonalVector(const btVector3& u)
void btDeformableContactProjection::update()
{
///solve rigid body constraints
m_world->getSolverInfo().m_numIterations = 1;
m_world->btMultiBodyDynamicsWorld::solveInternalConstraints(m_world->getSolverInfo());
{
m_world->getSolverInfo().m_numIterations = 1;
m_world->processIslands();
m_world->btMultiBodyDynamicsWorld::solveInternalConstraints(m_world->getSolverInfo()); // process constraints deferred in the previous step
}
// loop through constraints to set constrained values
for (int index = 0; index < m_constraints.size(); ++index)
{