I’m not getting a lot of answer at the animation forums, and this is kind of a scripting issue too.
I’m looking to play certain animator states while always skipping the first frame (that is, frame 0). Essentially i want to play from frame 1 to the end, and then loop from frame 1 again.
Additive animations require that first frame as a reference frame, so i can’t simply cut it out in the import settings, sadly.
i’m not quite sure where to start in that regard.
Would a low tech solution work? like polling the animator every frame and setting the frame number to 1 if it happens to be 0 ? is there anything more elegant i could pull off?
Doing some research on my own. I’ve gotten as far as using GetCurrentAnimatorStateInfo to find the normalisedTime of the current animation. I’m rather irked that it keeps going up instead of resetting to zero after each loop.
But anyways, normalised time on its own is not useful to me. I need either Actual Time, or a frame number. How can i get those.
And as for setting them, is there any more direct method than using animator.Play to simply restart the state at my desired time point?
And also, how do i get the name (or ID? ) of the current state, that i can feed back into Play?
Theres still a slight hiccup in each loop, but it’s getting smaller as i tweak the timing. However 0.05 here is a hardcoded estimate of where in the normalisedTime frame 1 might be. This needs to be adjusted for animation length… I still need to figure out how to actually measure frames, or set non-normalised time.
also, 2 is the number of my layer, that has to be adjusted for the layer wherever your anims are.
I’m following this thread because I’d also like to get additive animations to work properly. Cool that you got this far, but as you say yourself, this is really a hack. For instance, this cannot work well with blending. I would really like to hear from @Mecanim-Dev if there is a better way to loop additive animations.
I think i might have to implement manually set values per animation, based on trial and error of what looks good. I’m sure i can get it 99% perfect looking with enough poking.
I agree though this is a hack, there’s got to be a better way. Do you know any other mehods of altering animation playback?
i’d like to try increasing the sample rate and size of the anim too