Don't save body pos if "0 0 0".

PiperOrigin-RevId: 520598416
Change-Id: I5bb6ffaec386f228ac7a5fa221822000635900ae
This commit is contained in:
Yuval Tassa
2023-03-30 04:08:26 -07:00
committed by Copybara-Service
parent 3f9defa8d0
commit 1d6a9e09bb
2 changed files with 22 additions and 1 deletions
+5 -1
View File
@@ -1321,7 +1321,11 @@ void mjXWriter::Body(XMLElement* elem, mjCBody* body) {
if (body!=model->GetWorld()) {
WriteAttrTxt(elem, "name", body->name);
WriteAttrTxt(elem, "childclass", body->classname);
WriteAttr(elem, "pos", 3, body->locpos);
// write pos if it's not {0, 0, 0}
if (body->locpos[0] || body->locpos[1] || body->locpos[2]) {
WriteAttr(elem, "pos", 3, body->locpos);
}
WriteAttr(elem, "quat", 4, body->locquat, unitq);
if (body->mocap) {
WriteAttrKey(elem, "mocap", bool_map, 2, 1);