From e4e8f1ad93bcf08c4440beef5aeab0774cb50443 Mon Sep 17 00:00:00 2001 From: jingyuc Date: Wed, 11 Aug 2021 15:58:40 -0400 Subject: [PATCH] add tree updates in predict motion. --- examples/ReducedDeformableDemo/FreeFall.cpp | 2 +- .../BulletReducedSoftBody/btReducedSoftBodySolver.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/ReducedDeformableDemo/FreeFall.cpp b/examples/ReducedDeformableDemo/FreeFall.cpp index e12a7c9c0..96d11fd05 100644 --- a/examples/ReducedDeformableDemo/FreeFall.cpp +++ b/examples/ReducedDeformableDemo/FreeFall.cpp @@ -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; diff --git a/src/BulletSoftBody/BulletReducedSoftBody/btReducedSoftBodySolver.cpp b/src/BulletSoftBody/BulletReducedSoftBody/btReducedSoftBodySolver.cpp index 74704455d..94fae681b 100644 --- a/src/BulletSoftBody/BulletReducedSoftBody/btReducedSoftBodySolver.cpp +++ b/src/BulletSoftBody/BulletReducedSoftBody/btReducedSoftBodySolver.cpp @@ -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';