add tree updates in predict motion.

This commit is contained in:
jingyuc
2021-08-11 15:58:40 -04:00
parent 6355b06a8b
commit e4e8f1ad93
2 changed files with 10 additions and 1 deletions

View File

@@ -183,7 +183,7 @@ void FreeFall::initPhysics()
}
// create a static rigid box as the ground
{
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(5.), btScalar(5.), btScalar(0.5)));
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(3.), btScalar(3.), btScalar(0.1)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;

View File

@@ -26,6 +26,8 @@ void btReducedSoftBodySolver::predictMotion(btScalar solverdt)
// predict new mesh location
predictReduceDeformableMotion(solverdt);
//TODO: check if there is anything missed from btDeformableBodySolver::predictDeformableMotion
}
void btReducedSoftBodySolver::predictReduceDeformableMotion(btScalar solverdt)
@@ -76,6 +78,13 @@ void btReducedSoftBodySolver::predictReduceDeformableMotion(btScalar solverdt)
// update bounding box
rsb->updateBounds();
// update tree
rsb->updateNodeTree(true, true);
if (!rsb->m_fdbvt.empty())
{
rsb->updateFaceTree(true, true);
}
// std::cout << "bounds\n";
// std::cout << rsb->m_bounds[0][0] << '\t' << rsb->m_bounds[0][1] << '\t' << rsb->m_bounds[0][2] << '\n';
// std::cout << rsb->m_bounds[1][0] << '\t' << rsb->m_bounds[1][1] << '\t' << rsb->m_bounds[1][2] << '\n';