- Home /
Mecanim animator. Set speed of a single clip.
Hi.
I've just started working with the mecanim animation system. I use it to animate my player character. It also has a run animation. The speed of my character changes during the game thus i want to adjust the speed of the run animation accordingly.
Unfortunately I haven't found out yet how to change the speed of a single clip during runtime. Using Animator.speed would change the speed of all my animation but I only want to affect my run animation. So bsaically I am looking for something like the old animationState.speed.
Thank you
Answer by Daelus · Jan 16, 2013 at 03:43 PM
The easiest way I've found is to create a blend tree containing the same clip multiple times. Each one will have a speed attribute in the blend tree, then you can use whatever parameter you want to switch smoothly between the two speeds.
Thanks alot. This workaround does the trick. It is worth mentioning, that the effective speed of the animation is not calculated lineary. Worst example: If I set the first threshold to 0 with animation speed 0 and the second to 5 with speed 5 the effective animation speed will be 0 as long as my parameter is below 5. The lower speed generally seems to have a greater impact on the effective speed than the higher. I've been many thresholds with a distance of 2 to dampen this effect. The result looks pretty acceptable. It would still be nice if we could controll the speed directly.
Answer by manjav · Jan 18, 2013 at 04:25 PM
Hi When you dragged animation in animator controller or create blend tree you can changed speed of your clip in inspector tab.
Answer by KarlKarl2000 · Feb 12, 2017 at 04:21 PM
Sorry to necro a thread. But in case others find this thread like me. Unity came up with a solution (finally) after a couple years.
sharing is caring