Player not rotating with scripted root motion.

I’ve grabbed the script from the Unity tutorial: Scripting Root Motion for “in-place” humanoid animations.

The script for root motion for in-place animations looks like this:

function OnAnimatorMove() {
        var animator = GetComponent.<Animator>();
        if (animator) {

            var newPosition = transform.position;

            newPosition.z += animator.GetFloat("V Input") * Time.deltaTime;                           
            transform.position = newPosition;
     
            transform.localRotation = Quaternion.identity;
          
        }

    }

And my player control script looks like this:

#pragma strict

internal var animator : Animator;
var h : float;
var v : float;
var rotSpeed : float = 90.0;



function Start () {
    animator = GetComponent(Animator);

}

function Update () {
    h = Input.GetAxis("Horizontal");
    v = Input.GetAxis("Vertical");

}

function FixedUpdate () {
    animator.SetFloat ("V Input", v);
    transform.Rotate (new Vector3(0,h*Time.deltaTime*rotSpeed,0));

}

Why am I not getting any local character rotation? My character can only move forward and backwards. I’ll need to get my player rotating on the local axis and moving in the new direction.

I am telling you something I told someoneelse.Why don’t you get the Sample Assets (beta) from the asset store?It is what i did.You could learn from it.

Thanks Hard Target. Downloading now.

After some tinkering my player now rotates, but does not move in the direction he is facing. Regardless of my input, the player only translates forward (Vector3 world-space). I am assuming I have to get the local axis of the player, and translate the player in that direction. I have no idea how to do this, but I am guessing it involves a combination of transform.localEulerAngles and then a transform.position after?

Its intimidating that something that seems to be so simple in concept is so hard to execute.