bool createBody(BodyPtr& body, BodyInfo_impl& bodyInfo) { this->body = body; const char* name = bodyInfo.name(); body->setModelName(name); body->setName(name); int n = bodyInfo.links()->length(); linkInfoSeq = bodyInfo.links(); shapeInfoSeq = bodyInfo.shapes(); extraJointInfoSeq = bodyInfo.extraJoints(); int rootIndex = -1; for(int i=0; i < n; ++i){ if(linkInfoSeq[i].parentIndex < 0){ if(rootIndex < 0){ rootIndex = i; } else { // more than one root ! rootIndex = -1; break; } } } if(rootIndex >= 0){ // root exists Matrix33 Rs(Matrix33::Identity()); Link* rootLink = createLink(rootIndex, Rs); body->setRootLink(rootLink); body->setDefaultRootPosition(rootLink->b, rootLink->Rs); body->installCustomizer(); body->initializeConfiguration(); #if 0 setExtraJoints(); #endif return true; } return false; }