account for rotation in scripting root animation

I am using this method to move an ‘inplace’ animation. It works fine if the players rotation is 0,0,0,0 but as soon as I rotate the player the motion is not in the required direction.

This is expected as the animation moves along the set transform.z position but how do I account for the rotation angle so with the animations direction is correct.

Fixed this. the forward of the transform needs to be accounted for too on a rotating object.

transform.position += transform.forward * anim.GetFloat(“RootMotion”) * Time.deltaTime;