Animator question: need to transition smoothly between animations

I am making a VR FPS for android (daydream). This question is regarding gun animations. I have made all the animations I need to create realistic gun animations, similar to Crysis (PC video game). I need animation transitions to be absolutely seamless. I am aware that I can use blend trees, but am more comfortable with the simpler solution- to only allow an animation to be played if the last animation has competed. All of my gun animations start and end in the same exact position, across all animations. This way, if I ensure that animations only play when the gun is at the start/end position/rotation, there will be no sudden jumps when changing from one animation to the next. How do i do this? How do tell an animation to play only after the previous animation has reached its end (or a specific keyframe, since most of animations loop, so there is no real end)? Is there a simple, built in way to do this, before i start thinking too complex? (using animation events to change bool variable to allow for next animation to be played, or checking if transform is in the start/end position before applying the next animation. etc).

I noticed the animation class has a PlayQueued function, which plays an animation only if the current one is completed. But is it possible to use this function in Unity 5, in conjunction with an animator component? How?

look into has exit time.

Thanks man thats exactly what i was looking for. how do i control these conditions through code? right now im using code to to directly call animations themselves, which seems to be part of the problem, because im probably overriding all these other systems.

:slight_smile: I’m an animator so I don’t control anything via code.
I’m sure the documentation will tell you which code bit to write to get the same ‘has exit time’ control.

The solution for me was to not call animations though code at all, but to simply change animator transition conditions through code. the animator takes care of blending automatically if it is set up right. :slight_smile: very clean solution.

2 Likes