Linking animations to a variable's value??

hey guys, I’m wondering if this is possible…

first of all:

I have it so that when you hold down the mouse button, a variable rises it’s value from 1->14, and then goes back down to 1… then back to 14, etc etc etc. until you let go – basically this is a mechanism for adjusting the power for a fired projectile. that’s all hooked up fine.

what I want to know is if it’s possible to link an animation to that variable’s range, so as the variable is cycling through it’s values, at what ever speed i want, the animation plays directly in sync with it.

Yes, it looks as though you can do this with the AnimationState object.

If you notice, it has time and length variables, so presumably, if you set the animation playing with a speed of 0 and then set the animation time manually using the length and your variable to calculate the time, I guess that should work. I can’t test that in Unity at the moment, but that’s how I do it in Star Sentinel Tactics.

Sweet!
thanks a bunch!