We have hero object with animator in it. We need to play animation part-by-part following ingame progression.
Problem is, that dividing of animations must be done dynamically (e.g. in one case we need to divide animation into 3 parts, in other - into 6 parts)
Main functionality must be like this:
0% progress - animation didn’t played at all
33% progress - animation is played from 0% to 33% and then stopped at 33%
66% progress - animation is played from 33% to 66% and stopped at 66%
100% progress - animation is played from 66% to 100% and finished
I have animation with total 150 frames in it. I want to use only 93 frames of it
I am calculating progress of animation here: var pro = (1f / 150) * (93/100f) * progress; (progress is percentage of animation, that need to be played)
Both did the same: it just plays animation fully (starting from different time (pro value)
But I need to play animation from previous progress value to new one (e.g. from 0% to 20%, then 20% to 40%…)
I don’t think that CrossFade methods applicable for my problem. I need to play animation part-by-part depending on external progress variable. No needed to make transitions etc
if you just play animation parts, it will be jerky (there are no frames in the animation when playing, just normalizedtime, the “frames” are calculated from curves at a given update rate)
I’m pretty sure crossfades can do that
of course you need to track the state and the normalizedtime