If <composite flatinertia="true">, set mjCBody.explicit_inertial so that an <inertial> element is added in mj_saveLastXML. Bug found by the WriteReadCompare test.

PiperOrigin-RevId: 450702639
Change-Id: I978dfb6713d68ce8327f2e8eea1fc31f43a38b5e
This commit is contained in:
Alessio Quaglino
2022-05-24 09:38:06 -07:00
committed by Copybara-Service
parent dbf6c74f8f
commit 43e3b3a3f9
4 changed files with 15 additions and 6 deletions
+2
View File
@@ -764,6 +764,8 @@ mjCBody* mjCComposite::AddClothBody(mjCModel* model, mjCBody* body,
body->inertia[0] = body->mass*(size[1]*size[1]+size[2]*size[2])/3;
body->inertia[1] = body->mass*(size[0]*size[0]+size[2]*size[2])/3;
body->inertia[2] = body->mass*(size[0]*size[0]+size[1]*size[1])/3;
body->MakeInertialExplicit();
}
// add site