diff --git a/src/user/user_init.c b/src/user/user_init.c index 4ae5de6c..a9e0b64c 100644 --- a/src/user/user_init.c +++ b/src/user/user_init.c @@ -78,7 +78,6 @@ void mjs_defaultBody(mjsBody* body) { memset(body, 0, sizeof(mjsBody)); // body frame - body->pos[0] = mjNAN; body->quat[0] = 1; // inertial frame diff --git a/src/user/user_objects.cc b/src/user/user_objects.cc index aa37a895..b3c17780 100644 --- a/src/user/user_objects.cc +++ b/src/user/user_objects.cc @@ -1482,11 +1482,6 @@ void mjCBody::Compile(void) { } userdata_.resize(model->nuser_body); - // pos defaults to (0,0,0) - if (!mjuu_defined(pos[0])) { - mjuu_setvec(pos, 0, 0, 0); - } - // normalize user-defined quaternions mjuu_normvec(quat, 4); mjuu_normvec(iquat, 4); @@ -1524,23 +1519,12 @@ void mjCBody::Compile(void) { InertiaFromGeom(); } - // both pos and ipos undefined: error - if (!mjuu_defined(ipos[0]) && !mjuu_defined(pos[0])) { - throw mjCError(this, "body pos and ipos are both undefined"); - } - // ipos undefined: copy body frame into inertial - else if (!mjuu_defined(ipos[0])) { + if (!mjuu_defined(ipos[0])) { mjuu_copyvec(ipos, pos, 3); mjuu_copyvec(iquat, quat, 4); } - // pos undefined: copy inertial frame into body frame - else if (!mjuu_defined(pos[0])) { - mjuu_copyvec(pos, ipos, 3); - mjuu_copyvec(quat, iquat, 4); - } - // check and correct mass and inertia if (id>0) { // fix minimum