So I have made this JS script that works fine with walking. When the vertical axis is 0.01 or higher it goes from the idle to the walking animation.
The question is, how do I get it to play a sprint animation this way? Any other way is also fine aslong as it’s useable in this script.
I use the parameters ‘Walking’ and ‘Sprinting’.
#pragma strict
internal var animator : Animator;
var hor : float;
var ver : float;
function Start () {
animator = GetComponent(Animator);
}
function Update () {
hor = Input.GetAxis("Horizontal");
ver = Input.GetAxis("Vertical");
}
function FixedUpdate() {
animator.SetFloat("Walking", ver);
animator.SetFloat("Sprinting", ver);
}
Thanks!