- Home /
The question is answered, right answer was accepted
Animator changing state changes when triggered when it should change on float change
Hi!
So I have this AI. It is using a Character Controller to move and to animate my AI I've set it so it uses the CC velocity. So in my animator I have it to transition to walking when the velocity is greater then 0.1 and go back to idle when it is less then 0.1. The value is being set but the AI doesn't change state. I also have this blinking mechanic. It is a simple trigger called "Blink". And for some reason whenever that is triggered the AI animation state changes. So if I disable that it never changes. I have no idea why it does this and it have never happened before. What could be the problem?
If you need some code, here's some of the variable setting
//Sets the velocity variable.
anim.SetFloat("Velocity", controller.velocity.magnitude);
//Makes the AI blink.
anim.SetTrigger("Blink");
And yes, the velocity is over 0.1 before you ask.
Thanks in advance
Perhaps post some screeners of your transitions inspectors.
Here's a screenshot of the most important transitions.
I will also add that every time the blink trigger is called the AI tries to play the walking animation so it looks like it is twitching.
Does you idle -> walk transition work if there is only an exit time parameter?
Answer by RealMTG · Feb 16, 2015 at 01:28 AM
As it turns out it was mostly a Unity error. I just changed the animator to something else and changed it back and it worked. I have no idea how or why but I am glad it did.
Sometimes making changes requires the Animator to be 'Rebound'. This is a simple command and the editor will do it for you in most cases.
$$anonymous$$ostly though, people forget to click the object they are trying to observe.
A lot of errors come from the use of the Any State. These include strange self-looping and similar effects.
As soon as Blink has finished transitioning it will be classed within Any State and transition again to Blink.