- Home /
How do I control animation with a value?
I have an animation that I want to control with a value. If the value is zero then I want the animation to be at the start, if the value is at 0.5 the animation should be at its half point. how would I go about doing this? Thanks in advance.
Answer by Eno-Khaon · Apr 20, 2015 at 10:48 PM
http://docs.unity3d.com/ScriptReference/AnimationState.html
I believe that's what you're looking for? That will let you modify the state of the animation in many ways.
I'm not seeing any examples on the unity docs so I was wondering could explain to me how I can achieve what I'm saying? $$anonymous$$y gameobject has an animator component attached to it and I want to edit it threw script, how would I do this with AnimationState?
I admit, I haven't specifically messed around much with animations yet, but from what I can see, AnimationState.normalizedTime is exactly what you're looking for.
To quote the description there: "The normalized time of the animation.
A value of 1 is the end of the animation. A value of 0.5 is the middle of the animation."
Edit: $$anonymous$$y other source: http://answers.unity3d.com/questions/263512/animation-time.html
Your answer
Follow this Question
Related Questions
Dice Value 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to add keyframe animation to an imported FBX. 0 Answers
Animation at the end of the level 1 Answer