Update BVH during fusestatic. Fixes #1069 and #1577.

PiperOrigin-RevId: 631748750
Change-Id: I4e1ae01207568c90fc49bcd7d9f760f5187f1afa
This commit is contained in:
Alessio Quaglino
2024-05-08 04:12:04 -07:00
committed by Copybara-Service
parent 4eca3b048d
commit 96844db926
5 changed files with 42 additions and 9 deletions
+7 -1
View File
@@ -2969,12 +2969,18 @@ void mjCModel::FuseStatic(void) {
// recompute parent contype, conaffinity, and margin
par->contype = par->conaffinity = 0;
par->margin = 0;
for (const auto& geom : geoms) {
for (const auto& geom : par->geoms) {
par->contype |= geom->contype;
par->conaffinity |= geom->conaffinity;
par->margin = mju_max(par->margin, geom->margin);
}
// recompute BVH
int nbvhfuse = body->tree.nbvh + par->tree.nbvh;
par->ComputeBVH();
nbvhstatic += par->tree.nbvh - nbvhfuse;
nbvh += par->tree.nbvh - nbvhfuse;
//------------- delete body (without deleting children)
// delete allocation