mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-09 17:10:09 +00:00
only call buildIslands once for multibody in each timestep
This commit is contained in:
parent
f1e7ce9ce1
commit
3dc8abcf36
@ -233,7 +233,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher, btCollisi
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
// btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
{
|
||||
if (colObj0->getActivationState() == ACTIVE_TAG ||
|
||||
@ -257,7 +257,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher, btCollisi
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
// btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
{
|
||||
@ -278,7 +278,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher, btCollisi
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
// btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
|
||||
|
||||
if (colObj0->getIslandTag() == islandId)
|
||||
|
@ -428,14 +428,18 @@ void btMultiBodyDynamicsWorld::forwardKinematics()
|
||||
void btMultiBodyDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
|
||||
{
|
||||
solveExternalForces(solverInfo);
|
||||
buildIslands();
|
||||
solveInternalConstraints(solverInfo);
|
||||
}
|
||||
|
||||
void btMultiBodyDynamicsWorld::buildIslands()
|
||||
{
|
||||
m_islandManager->buildAndProcessIslands(getCollisionWorld()->getDispatcher(), getCollisionWorld(), m_solverMultiBodyIslandCallback);
|
||||
}
|
||||
|
||||
void btMultiBodyDynamicsWorld::solveInternalConstraints(btContactSolverInfo& solverInfo)
|
||||
{
|
||||
/// solve all the constraints for this island
|
||||
m_islandManager->buildAndProcessIslands(getCollisionWorld()->getDispatcher(), getCollisionWorld(), m_solverMultiBodyIslandCallback);
|
||||
|
||||
m_solverMultiBodyIslandCallback->processConstraints();
|
||||
|
||||
m_constraintSolver->allSolved(solverInfo, m_debugDrawer);
|
||||
|
@ -116,6 +116,7 @@ public:
|
||||
|
||||
virtual void solveExternalForces(btContactSolverInfo& solverInfo);
|
||||
virtual void solveInternalConstraints(btContactSolverInfo& solverInfo);
|
||||
void buildIslands();
|
||||
|
||||
};
|
||||
#endif //BT_MULTIBODY_DYNAMICS_WORLD_H
|
||||
|
@ -128,3 +128,11 @@ void btDeformableBackwardEulerObjective::initialGuess(TVStack& dv, const TVStack
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set constraints as projections
|
||||
void btDeformableBackwardEulerObjective::setConstraints()
|
||||
{
|
||||
// build islands for multibody solve
|
||||
m_world->btMultiBodyDynamicsWorld::buildIslands();
|
||||
projection.setConstraints();
|
||||
}
|
||||
|
@ -73,10 +73,7 @@ public:
|
||||
void updateVelocity(const TVStack& dv);
|
||||
|
||||
//set constraints as projections
|
||||
void setConstraints()
|
||||
{
|
||||
projection.setConstraints();
|
||||
}
|
||||
void setConstraints();
|
||||
|
||||
// update the projections and project the residual
|
||||
void project(TVStack& r)
|
||||
|
@ -31,7 +31,7 @@ void btDeformableBodySolver::solveConstraints(float solverdt)
|
||||
backupVelocity();
|
||||
|
||||
m_objective->computeResidual(solverdt, m_residual);
|
||||
// m_objective->initialGuess(m_dv, m_residual);
|
||||
|
||||
computeStep(m_dv, m_residual);
|
||||
updateVelocity();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user