@chumbyfuzz wrote:
I have a 3d model of a human skeleton.
Currently I do the following:
Bone3D* node; //The bone I want to set the orientation of. Mat4 mat = node->getLocalMat(); //I modified Skeleton3d to let me access the local matrix Vec3 pos, scale; // store original translation & scale mat.getTranslation(&pos); mat.getScale(&scale); // reset matrix mat.setIdentity(); // create float array for translation float trans[3]; trans[0] = pos.x; trans[1] = pos.y; trans[2] = pos.z; // create float array for scale float s[3]; s[0] = scale.x; s[1] = scale.y; s[2] = scale.z; // create quaternion float array for rotation Quaternion q = ToQuaternion(yaw,pitch,roll); float rot[4]; rot[0] = q.x; rot[1] = q.y; rot[2] = q.z; rot[3] = q.w; // send transform values to bone node->setAnimationValue(trans, rot, s);
By doing this, I am able to set the angle of the bone relative to its parent bone (similar to how localspace works with 2d sprites), but I am not able to set the orientation of the bone in 3d space. How can I do that ? I still want the location of the bone to be where it should be (it should be attached to its parent at the correct place), but I want to be able to set its yaw, pitch and roll, relative to the world.
Posts: 1
Participants: 1