sun.wenquan Posted March 28, 2016 Share Posted March 28, 2016 I am a new user of Unigine Engine. now I get a task of doing a character animation using motion capture data. the motion capture device is similar to the A.R.T system. The data give me the position of bones of human body. I want to know how to apply this data to a objectmeshskinned model. I got these mothods of class objectmeshskinned : "void setBoneChildsTransform(int bone,const mat4 &transform) const; void setFrameBoneTransform(int bone,const mat4 &transform) const;" can change the shape of the model. but I do not know how to compute the right matrix ,especially the rotation matrix. Link to comment
maxi Posted March 28, 2016 Share Posted March 28, 2016 Hi sun.wenquan, If you just need to change bones positions, you can get current bone transform matrix and change it's position like this: vec3 new_bone_position; mat4 t = skinned->getBoneTransform(num); t.setTranslate(new_bone_position); skinned->setBoneTransform(num, t); But depending of your data, you may need to choose among these functions: - setBoneTransform: sets bone's transform in local coordinates, relative to parent bone - setWorldBoneTransform: sets bone's transform in global coordinates - setBoneChildrenTransform / setWorldBoneChildrenTransform: sets transform for the current bone and updates all its children bones. Link to comment
Recommended Posts