I’ve got an Animator containing AnimationClips that have translation data within them. Basically I like the idea of drawing up curves in AnimationClips and then I can use that data to move my characters about.
I sometimes need to raycast these movements so that the enemy doesn’t end up crashing in a wall and with AnimationClip.SampleAnimation(): I can evaluate the whole animation in a single frame in a for loop! Really cool.
Now one last problem remains: I can’t access the AnimationClips I want because they need to be playing with Animator.GetCurrentAnimatorClipInfo(_layer) and Animator.Play() only activates itself when the frame is over. So if I want to raycast a movement before getting into its movement, I will have to first lose 1 frame.
So every time I want to have access to a curve of an AnimationClip in the Animator, I need to play the state that contains the AnimationClip but to play it I must wait 1 frame. So my AI has frames where he does nothing.
Can I access AnimationClips within an Animator more easily than with Play()? What can I do in this situation?