- Home /
Confused at triggering a simple animation
I read the manual, watched a couple of tutorials read on the forums but I don't get how a simple animation is supposed to be triggered. I have an object which for 99% of the time isn't animated but for a short moment it needs to shake a little.
I made an Animator Controller
and an Animation
. I dragged the animation into the controller as a state. This is where it gets fuzzy.
There's an Entry
and Any State
states and the my clip gets automatically linked to Entry
.
I want the clip to run when a trigger is true, NOT automatically at start.
Possible solution:
All I need is Any State
transitioned to my animation. So I thought I should make a dummy state to "lure" Entry
into, so to shake the transition off my animation, since apparently I can't delete the transition from Entry
to my animation. But I don't think this is the right way to do, but more of a ghetto workaround.
What's the right way, I'm asking?
Answer by FortisVenaliter · Aug 03, 2017 at 08:40 PM
An animator controller can't have "no state".
You need an "idle" animation for when it's not shaking. Have it go from entry to looping idle. When the trigger happens, it can transition to the shake animation, play once, and then go back to idle.
Then perhaps it's better to use the legacy animation? But I'm trying to stay away as it'll probably be deprecated/taken out. $$anonymous$$y scenario merely implies something like "if input, then play the (only) animation".
I wouldn't need the whole complexity of the animator controller with states, transitions, parameters and what not. After all, the Animator looks like it's been re-thought as a fully fledged state machine rather than an animation-player.
Correct, but a two-state machine would have little overhead. And the idle animation can have zero keyframes, which would have zero overhead, so it's still probably the cleanest solution.
Answer by a161803398874 · Aug 03, 2017 at 09:34 PM
check this thread on how to trigger an animation http://answers.unity3d.com/questions/1386713/animator-and-scripting-problems-help.html?childToView=1388007#answer-1388007
This has nothing to do with my case. That's in general how to normally use the Animator with animations.