How to do Turn animations with root motion (root bone rotations)?

I am stuck in a situation right now. I have made a character in blender and made some animation clips (Walk, Run, Idle, Turn Left 45) with root motion (moving the root bone).

I have managed to get Walk and Run working with root motion by using OnAnimatorMove() function but I cannot get my “Turn Left 45” to work properly. In “Turn Left 45” I rotate the root bone towards left 45 and animate the character turning towards left and the character stops at 45 degree. This is my animation.

But in Unity when I use this in game, the character does not turn (rotate) at all and it plays the animation while facing forward. Means it moves its legs and body according to the animation but does not turn at all, its rotation in game remains same. Why is it not turning with root bone. In walk and run animations the entire character is moving forward with root bone then why not in Turn Left 45.

Settings that I have used in all animation clips in Unity are as follows :-

Root Transform Rotation, Root Transform Position (Y), Root Transform Position (XZ)
Based Upon = Original, in all three

Ok so if anyone looking for an answer for this then I have figured it out.

The reason why my character was not turning and only playing body and leg movement was because of this little guy :-


Here’s a thing about this guy, if you leave this function empty (do not write anything in this) even then it will override root motion. So in my case I only had translation (forward and backward, XZ movement) code in my OnAnimatorMove(). If you do not have proper Rotation code in this function then it will not allow your character to rotate at all even if you are playing a turn rotation that has root bone rotation in it. So have proper rotation and translation code inside this function and then play your animations, your animations should work fine.

Here’s what my OnAnimatorMove now looks like :-

void OnAnimatorMove()
agent.velocity = anim.deltaPosition / Time.deltaTime;

Quaternion lookRotation = Quaternion.LookRotation(agent.desiredVelocity);
            transform.rotation = Quaternion.RotateTowards(transform.rotation,
                lookRotation, agent.angularSpeed * Time.deltaTime);


Select animation’s import settings > Disable “Bake into pose”,
Set “Based upon” to “Body orientation”.

Now you don’t need extra rotation code just ensure you enable apply root motion in animator’s inspector or through ApplyBuiltinRootMotion() calls in OnAnimatorMove() method.