Bone transformation

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
andreahmed
Kobold
Posts: 38
Joined: Wed Dec 31, 2014 2:26 am

Bone transformation

Post by andreahmed » Sat Sep 30, 2017 6:47 pm

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
0 x

Post Reply