Skip to content

Commit

Permalink
Always compute the convex hull if the mesh inertia is set to convex.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 723477903
Change-Id: Ibc50d62741f47a5b96a648efd8fb244810664c17
  • Loading branch information
quagla authored and copybara-github committed Feb 5, 2025
1 parent 49d07c6 commit fe16c27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/user/user_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4243,8 +4243,9 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) {
// mark meshes that need convex hull
for (int i=0; i<geoms_.size(); i++) {
if (geoms_[i]->mesh &&
(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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/user/testdata/inertia_compare.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</asset>
<worldbody>
<body>
<geom type="mesh" mesh="incomplete_convex"/>
<geom type="mesh" mesh="incomplete_convex" contype="0" conaffinity="0"/>
</body>
<body>
<geom type="mesh" mesh="incomplete"/>
Expand Down

0 comments on commit fe16c27

Please sign in to comment.