Page 1 of 1

Bone transformation

Posted: Sat Sep 30, 2017 6:47 pm
by andreahmed
I'm trying to use ogreassimp converter which converts an fbx file into ogre mesh file with skeleton.. I have problems decompsing the local bone transformation, what assimp provides is

// 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;

        }
and here is a video that shows the problem more https://vimeo.com/236206900