I am using Assimp library to load bone and mesh data and using basic interpolation to accomplish the animation part. Right now I want to move my character position with animation, i.e. root motion.

What I tried is just advance the position with translation value of root bone. I transformed this translation value with "world space rotation and translation matrix", which doesn't contain scale. (Do I also need to use scale matrix?)

Here's the simplified version of code: (assume all interpolation is happening in root joint)

 void RootBoneUpdate(float animationTime,AnimationComponent* handle)
    vec3 translation = InterpolatePosition(animationTime);
    quat rotation = InterpolateRotation(animationTime);
    vec3 scale = InterpolateScaling(animationTime);

        TransformComponent transform = currentActor->GetComponent<TransformComponent>();
        RigidBodyComponent rigidBody = currentActor->GetComponent<RigidBodyComponent>();

        worldSpaceBoneTranslation = transformComponent->GetTRMatrix() * tranlsation;

//not modifying Y coordinate
        rigidBody.x = worldSpaceBoneTranslation.x; 
        rigidBody.z = worldSpaceBoneTranslation.z;

Problem: It's working, but the game actors are moving really fast.

My understanding is that the software used to create animation must have a different coordinate space with bigger scale. Do I need to again scale the worldSpaceBoneTranslation or am I doing something wrong?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.