// DefBonePose a matrix that represents the local bone transform (can build from Ogre bone components)
// PoseToKey a matrix representing the keyframe translation
// What assimp stores aiNodeAnim IS the decomposed form of the transform (DefBonePose * PoseToKey)
// To get PoseToKey which is what Ogre needs we'ed have to build the transform from components in
// aiNodeAnim and then DefBonePose.Inverse() * aiNodeAnim(generated transform) will be the right transform
Here is how I get the bone transformation
Code: Select all
if(mSkeleton->hasBone(boneName))
{
Ogre::Bone* bone = mSkeleton->getBone(boneName);
Ogre::Matrix4 defBonePose;
Ogre::Matrix4 parentBoneInverse;
Ogre::Matrix4 fullMatrix;
Ogre::Matrix4 BoneWorld;
BoneWorld.makeTransform(bone->getPosition(), bone->getScale(), bone->getOrientation());
if (bone->getParent())
{
Ogre::Matrix4 BoneParentWorld;
BoneParentWorld.makeInverseTransform(bone->getParent()->getPosition(), bone->getParent()->getScale(),
bone->getParent()->getOrientation());
fullMatrix = BoneParentWorld*BoneWorld;
}
else
{
fullMatrix = BoneWorld;
}