đ´Animator Blend Trees
Animate and choreograph characters with smooth transitions
Last updated
Animate and choreograph characters with smooth transitions
Last updated
Unity Animator provides an excellent system for complex animations using blend trees and control parameters to smoothly transition from one state to another. This is often used to control characters with player input, however can also be controlled by Timeflow animation channels.
This documentation assumes you are already familiar with using Animator components and blend trees. Please refer to the Unity documentation on Blend Trees for further information.
Find the included example in:
Assets/AxonGenesis/Timeflow/Samples/Demo/Scenes/Animation/AnimatorBlendTrees.unity
Following is an example blend tree with several animation states and conditional transitions leading from one to another. Notice that it's possible to blend from the idle animation to any of the other states, but some states cannot directly transition to one another. Keep this in mind when animating parameters.
In the Timeflow view, Animator parameters are automatically listed as properties that can be added as animation channels or other behaviors such as Blend and Tween.
Please note that Animator parameters cannot be used with Animation Clips on the same object, since playing clips directly requires that the Animator component is disabled.
Parameters animated in Timeflow are applied to the Animator, with data being sent frame-by-frame to each parameter, similar to how player input is processed each frame. This allows full or partial control over character animations that can override or blend with player input.
While player input is only available at runtime, Timeflow can play Animator sequences in edit mode so you can easily preview and edit animations.
Please note that you must play the Timeflow view to see animations. When manually moving or jumping in time, animation isn't updated. This is due to the way Animator handles updating, which isn't fixed in time but rather responds to events and requires continuous playing to function.
The example scene included (see above) demonstrates the use of a simplified script to switch between player input and sequenced animation using Timeflow.
This example enables and disables the TimeflowObject, allowing player input to pass through when it is no longer updating in Timeflow. The script also includes example code to get references to behaviors and channels.
When the scene starts, the animation sequence plays automatically until any one of the input keys shown above is pressed, allowing the player to take control over the character. Timeflow animation can then be resumed by pressing the spacebar.
Alternatively or in addition to disabling animation objects via scripting, you can also use tracks to choreograph sequences at specific times in the scene. For example, this could be used to begin a scene with an animated sequenced, and then allow the player to take control.
As shown in the screenshot above, channels are only updated during active track areas, so the parameters are unaffected between tracks, allowing player input or other control to take over. Animation then resumes at the next track section, looping the animation within each channel.
You can also use Markers and the Work Area to create choreographed sections of time which can be played in sequence, or jumped to dynamically. This makes it possible with minimal scripting to integrate Timeflow animation sequences with a scene controller to have an intro, outro, and any number of cut scenes or other triggered animation layers overriding or layering on top of any player input and other game mechanics.
If both player input and Timeflow animation are occurring at the same time on the same parameter, it is likely to cause issues and produce unexpected results. Make sure whichever method you use that only one thing is controlling each parameter at a time.
Animator is not playing an AnimatorController
If you see this warning in the console, it means that the Animator component is not ready for playback. If this occurs, starting and stopping playback in the Timeflow view usually resolves it, or alternatively you can try clicking the Axon Genesis logo in the Timeflow view to force refresh the scene. If the problem persists, check that the Animator component is enabled.