- Home /
What is the meaning of normalizedSpeed?
I don't understand the meaning of AnimationState.normalizedSpeed, I get that it is used for syncing animations, but I don't quite get it.
So that was the question I had. Since this seems like a good thing to know, I played around with things and think I finally get it. See the answer (or make the answer better...)
One $$anonymous$$or point - the actual variable name is normalizedSpeed, a single word. I was searching for information on this term, and Search didn't find the two-word version, so I wound up creating a duplicate question. Wups... :)
Answer by bruceb · Feb 17, 2010 at 09:27 PM
The best way to think about normalized speed (IMO) is that it is the number of cycles the animation can make in a second. So, if your animation's nominal length is .66, its normalized speed is 1.5 or (1.0/0.66). In otherwords, your animation does 1.5 cycles per second.
Now suppose you set the speed of the animation to be 1.2. In this case the effective length of the animation is .55 sec (0.66/1.2). And the normalized speed is now 1.8 (1.0/0.55), or a little less than 2 cycles per sec.
Thinking about normalized speed as cycles/second makes it easy to see why SyncLayer is needed and why it works. If you have cyclic gaits such as walk and run and you want to blend them, then the only way that makes sense is the cycles per second are adjusted to be the same which is what SyncLayer does.
another way to think about normalized speed is that the delta in normalized time on a frame is normalizedSpeed * Time.deltaTime.
I think SyncLayer() works a little different than I said because it averages the duration, so the normalized time for each animation changes by the same amount on a tick, rather than adjusting the normalized speed of the sync'd animations. The effect is the same though.
Answer by bruceb · Feb 22, 2010 at 07:48 PM
Just to finish up on this. If you ever need to know "how fast is my animation actually going, relative to when it is unsynched and has a speed of 1.0", you can do the following...
- Keep track of the actual delta in normalized time from frame to frame.
- Compare it to Time.deltaTime * (1.0/anim.length). The ratio will tell you the relative speed.
You need to be careful to make sure that the delta in normalized time is valid (if the animation rewinds in between samples, the delta won't be valid), and there may be a simpler way of doing this, but this worked for me.
Your answer
Follow this Question
Related Questions
Allow Unity to render as fast as possible? 0 Answers
How do I adjust the speed of an animation when preparing a CMU Motion Capture in Blender 2.68? 0 Answers
Animation speed control - no smooth animation on slow down 3 Answers
How to change speed of animation in C# 1 Answer
Is it possible to change animation speed in itween? 1 Answer