Friday, November 17, 2017

In Unity, why do my animator states wait until the end of each animation to change?


I'm trying to make a simple idle-walk transition in Animator using Unity. I've set a script that changes the Speed value from the Animator, and it works perfectly when I move the character forward when the game is on.


The transitions work well between both animations, except that they don't start automatically after the speed has changed to greater than zero.



I've found out that it waits until the animation loop gets to it's end, which makes the game feel dull and not fluid at all.




I don't think there's an issue with the code, but I'm attaching it anyway:


#pragma strict
var anim : Animator;

function Start () {
anim = GetComponent("Animator");
}


function Update () {
var move : float = Input.GetAxis ("Vertical");
anim.SetFloat("Speed",move);
transform.Rotate(0,Input.GetAxis("Horizontal"),0);
transform.Translate(0,0,(Input.GetAxis("Vertical")*Time.deltaTime*move));
}


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...