Mecanim: scrub through an animation?

Hi,

I was wondering if it’s possible to scrub through an animation in runtime by scripting a float parameter or something like that in Mecanim?

So far, I’ve managed to use a blend tree to scrub between poses (animations with a single frame) with acceptable results, but if the animation is complex, setting up a lot of poses is pretty time consuming.

Any ideas on how to properly scrub through an animation using Mecanim?

Found it :slight_smile:
http://docs.unity3d.com/Documentation/ScriptReference/Animator.ForceStateNormalizedTime.html

Does anyone know how to deal with scrubbing the transitions though?

Our use case is we are implementing a mecanim timeline in Unity for our artists. During playback we use the new Crossfade method in 4.3 to crossfade between states. This works well. However on scrubbing we have implemented essentially what Peter describes above (4.3 no longer has ForceStateNormalizedTime but you can play at a specific time and set playback speed to zero). This also works well except during the transition/crossfading periods (the transitions don’t exist). Thus the animations pop in between state changes during scrubbing.

I have made some prototype blendtrees as a workaround to use during scrubbing but I can’t seem to match the in/out function of unity’s crossfade method (scrubbing and playback produce different crossfading results). Should I just use blendtrees and control the crossfading myself during playback or is there a better way (I’m thinking there must be)?

Thanks!