Play/blend animations, animator controllers in runtime. Uses playable API
Animation library for unity engine built on top of Playable API.
Vortex is an animation library for unity engine built on top of Playable API. FAnimator mono behaviour script is the heart of Vortex. It is the equivalent of the Animator component of unity engine. It plays animations, mixes animations and then plays.
You can play or mix animation clips or controllers anytime without using animator controllers. You can use animator controllers too if you wish.
Let's say you need a sequence of animations, like this -
With vortex it is simply calling a set of methods chained with callbacks; all in a single script, in event single method!
And many more to follow!
Add FAnimator component to the gameobject that also has an Animator component.
And you are done!
Always
to update always. Only Gameobject Active
to update
only when gameobject is active. Gameobject active and Camera visible
to
update only when the model gameobject is active and it is being viewed by the
camera(inside the camera frustrum).Clip start time offset
normalized(of default
clip) amount.Window > Analysis > PlayableGraph Visualizer
.Animations comes in three forms:
FAnimator can play or Mixes and play all three forms of animation data.
FAnimationClip works on top of unity Animation clip but with many extra features. For example, the following code will make the fbx model having “FAnimator” (“anim” variable) to animate with “runclip” or simply put the model will start running.
Now let's look at the inspector:
So the run clip is a unity clip named “fasRun” and it is looped. There are other three modes we can incorporate. Speed is 1. We can ignore repetition and looping animation time since the mode is set as “loop”. When the animation is started, “light1” is turned on. The “light1” is turned off when the animation ends. When the animation crosses 45%, the “light2” is turned on.
FAnimators can have four modes in total:
“Looping animation time” is applicable No3 or “loop ended with time” mode. “Repetition” is applicable for No4 or “Play N time” mode. The Start Event or End Event or Middle events can also be accessed with script.
Followings are the API methods of FAnimator:
DisableTransition()
: If you want no transition then first call this method
on the FAnimator object then play or mix animations. You will not have any
transition, the animation will play suddenly without any smoothness.AbortSequenceIfAny()
: If you are already playing a sequence on the FAnimator
Object then calling this method will abort the sequence. Sequence is a type of
Animation task. More on Animation tasks later.MixWithCurrent()
: Mix N number of AnimationClip or FAnimationClip or
Controllers with currently whatever playing. Then play the mixer.MixAndPlay()
: Same as MixWithCurrent()
but does not mix with currently
playing animation data.Play()
: Plays AnimationClip or FAnimationClip or Controller.PlayNormalized()
: Same as Play() but for transition time, it uses
normalization instead of absolute value. The normalization occurs with respect
to animation clip length in conjunction with speed value, the duration.PauseAnimation()
: Pause animation making it as if the model is frozen in time.ResumeAnimation()
: Resume animation making it play from the last keyframe it
originally was.SetAllRunningAnimationToBindPose()
: Set model into bind pose effectively
playing no animation.RunAnimationTask()
: Run Animation task on the FAnimator object. More on
animation tasks later.Let us take a look at the following code:
So what is the task’s implementation? For that, let us look at the inspector:
The level designer set it as a “PlaySequence”. PlaySequence is a type of builtin animation task. There are in total six animation tasks built in, for most situations this will suffice but you can of course create your own animation task. Just create a class that does not inherit from UnityEngine.Object(this is by design from unity) and makes it inherit from “IAnimationTask” interface. Of course make the class serializable. And you have made your very own animation task.
Plays an animation that lives inside an animator controller and the animator controller is assigned in the Animator component. This Animator component’s gameobject named “anim”.
Plays a FAnimation clip.
Plays an animator controller.