I’m trying to make it so my 2D rigged character aims his gun towards the mouse. I have an override layer with an animation called “Aim”, that only affects the arm. It has 180 frames, each frame corresponding to a rotation value. (e.g. frame 90 = 90 degree rotation of the arm)
I need to set the “Aim” animation to a specific frame so that it will rotate. So far all I’ve found that could be useful is anim.Play(). Example of what I got so far:
anim.Play ("Aim", 1, 0.5f);
“Aim” being the animation name, of course. “1” is the layer, “0.5f” is the time in the animation for it to play. My problem here is that it goes from 0 - 1, not from 0 - max frames. So I don’t know how to go to a specific frame using this function. I’m basically looking for a math equation that’d let me set the animation to a specific frame using the .Play() function. I know it’s possible as I’ve done it before, but I don’t have access to my old project files anymore. Can someone lend a hand?