From fe16c2755525a68890c5578666e2109b01e4c793 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Wed, 5 Feb 2025 05:51:20 -0800 Subject: [PATCH] Always compute the convex hull if the mesh inertia is set to convex. PiperOrigin-RevId: 723477903 Change-Id: Ibc50d62741f47a5b96a648efd8fb244810664c17 --- src/user/user_model.cc | 5 +++-- test/user/testdata/inertia_compare.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/user/user_model.cc b/src/user/user_model.cc index 9fe4113a..db330026 100644 --- a/src/user/user_model.cc +++ b/src/user/user_model.cc @@ -4243,8 +4243,9 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) { // mark meshes that need convex hull for (int i=0; imesh && - (geoms_[i]->spec.type==mjGEOM_MESH || geoms_[i]->spec.type==mjGEOM_SDF) && - (geoms_[i]->spec.contype || geoms_[i]->spec.conaffinity)) { + (geoms_[i]->spec.type == mjGEOM_MESH || geoms_[i]->spec.type == mjGEOM_SDF) && + (geoms_[i]->spec.contype || geoms_[i]->spec.conaffinity || + geoms_[i]->mesh->spec.inertia == mjINERTIA_CONVEX)) { geoms_[i]->mesh->SetNeedHull(true); } } diff --git a/test/user/testdata/inertia_compare.xml b/test/user/testdata/inertia_compare.xml index f59d1199..d497809d 100644 --- a/test/user/testdata/inertia_compare.xml +++ b/test/user/testdata/inertia_compare.xml @@ -12,7 +12,7 @@ - +