Do not infer inertia if geom is not in inertiagrouprange.

PiperOrigin-RevId: 483994271
Change-Id: Ia663cd30e93d9c3a2e32408a658f091af4d1ca1a
This commit is contained in:
Alessio Quaglino
2022-10-26 09:44:44 -07:00
committed by Copybara-Service
parent da33c5922f
commit f695f55253
2 changed files with 42 additions and 2 deletions
+4 -2
View File
@@ -701,8 +701,10 @@ void mjCBody::Compile(void) {
// compile all geoms, phase 1
for (i=0; i<geoms.size(); i++) {
geoms[i]->inferinertia = id>0 && (!explicitinertial ||
model->inertiafromgeom==mjINERTIAFROMGEOM_TRUE);
geoms[i]->inferinertia = id>0 &&
(!explicitinertial || model->inertiafromgeom == mjINERTIAFROMGEOM_TRUE) &&
geoms[i]->group >= model->inertiagrouprange[0] &&
geoms[i]->group <= model->inertiagrouprange[1];
geoms[i]->Compile();
}