Animation Controllers

written by child of the beast

Intro

If you don’t already have the animator window open. You can open it by going to the top of Unity in the Menu Bar at “Window>Animation>Animator”

We’re going to be using the Base Layer’s example controller as an example for this guide. If you’re following along in-editor, you can find it here:

“Asstes/VRCSDK/Examples3/Animation/Controllers/vrc_AvatarV3LocomotionLayer.controller”

The example base layer controller looks like this

This can look a little overwhelming at first but let’s break it down into parts.

But before we begin, remember to ALWAYS KEEP BACKUPS.

Click the controller in your “Project” tab and press Ctrl+D to make a copy of it. you can then rename it and move it to somewhere where you’ll remember where it is.

Entry

This is where the controller starts. It points to the animation state that your animation controller starts in, which in this case would be Standing.

Animation States

Animation states hold either a Blend Tree or an Animation in them. They transition between each other with translations that you can add conditions into.

This is what they look like

To create animation states, you right click and hit “Create State>Empty”

We won’t be creating any states in the guide.

You you click on an animation state. This is what shows up in your Inspector.

You’re going to use these 3 things in a state the most, Motion Speed and Mirror.

Motion

Motion is the animation that plays in that state.

Speed

Speed is the speed the animation plays at (1 being default).

This can be a negative number to play the animation backwards.

Mirror

Mirror mirrors the animation example being:

If you have a “walk right” animation, and mirror it. You can then use it as a “walk left” animation.

Parameters

Parameters hold all of the animators data. These would be Floats, Ints, Bools, and Triggers.

You can open the Parameters menu one of 2 ways.

You can open it in its own window by going to your menu bar under

“Window>Animation>Animator Parameter”

or in the animator itself by using the tab next to the Layers tab.

There are 4 different parameters. We’ll break each down into its own mini section and go over what they are. I’ll go over what they’re used for in later sections.

Float

Floats hold numbers along with decimals

Examples of floats:

0

140

-36

1.56

-1.89

-450.9

Int

Ints (short for Integers) are WHOLE numbers. It cannot hold decimals.

Examples of Ints:

0

140

-36

100

-100

-450

Bool

Bools (short for Boolean) is a fancy word for True or False.

These can only ever hold two things:

1 (true) or 0 (false).

Trigger

Triggers aren’t really like the rest of the parameters. They’re sort of like a bool (true or false) but do not actually store data. You’d use them mostly in transitions to trigger an animation state that you only want to play when you tell it to, without having to manually reset a bool yourself.

Transitions

Transitions are a big part of your animation controller. They hold all of the controller’s logic, or in other words: they control when to swap animation states.

Every line/arrow in between an animation state is a Transition.

Right click on any Animation State to create a new transition.

You can also click on any of the transitions to bring them up in the Inspector View.

Let’s break down the Inspector view.

Transitions

There’s 2 options in the Transitions section. We’re going to be ignoring these since they’re mostly for previewing/debugging more complex state machines but i’ll go over them briefly.

Solo: plays only that transition

Mute: Disables the transition

Exit Time

Exit time specifies when the transition to the next animation state starts. Keep in mind, exit time is in percent and not seconds.

Some examples:

If exit time is 1, the transition will wait for the animation to fully play before the transition begins.

If exit time is .75, the transition will only start if 75% of the animation has played. 

If exit time isn’t check, the transition will start instantly.

Fixed Duration

Fixed duration has 3 parts: Fixed, Duration, and Offset. These are represented by the blue section in the preview here:

Fixed Duration toggles between Percent and Seconds.

Duration is how long the blending between the states takes, either in Percent of the animation or seconds.

Offset controls when the blending between the states begins inside of the transition. This is a percent.

0 will start blending instantly.

.5 will start half way though the animation.

Duration and Offset can both be edited inside the preview to make things a little bit easier to visualize.

Conditions

Conditions are where the logic is held. You pick a parameter and choose what happens based on the chosen parameter.

In the example transition these are:

if “Upright” is less than .41

AND

if “Supine” is false

If both of these conditions are met, the transition will start.

Blend Trees

I’m going to continue using the Standing state as an example here.

Double click on the Standing State to open up it’s Blend Tree in the animator.

This is where the Standing idle animation is held as well as the walking animations, or in this case the Blend Tree that contains them. A blend tree is kind of like an animation.

This is the Blend Tree for Standing.

 

It holds all of the default Proxy animations for VRChat. Keep in mind, VRChat replaces these when you upload an avatar, they are not the real animations that get uploaded with your avatar. If you want to replace only a specific part of the walking animation, you would do it here.

I’m going to break the last parts of Blend Trees into 3 different sub sections. The first going over what blend trees do, another for replacing a part of the blend tree and one for replacing the entire blend tree with a new animation.

Blend Tree Overview

Here’s the Blend Tree in the Inspector View.

The parts i’m going to be covering are Parameters, Motion, PosX/PoxY, the clock, the little half guy and what that blue box is with the diamonds. I won’t be covering Blend Type.

Parameters

Parameters are 2 drop down menus where you choose what parameters PosX and PosY are tied to.

Motion

Motion is where you put your animation.

Pos X/Y

These decide what your blend tree is currently doing. In VRChat’s case, these are your X and V velocity in most cases.

What you set these to determines what animation currently has the most weight.

Clock

This is what speed the animation plays at.

Remember, this can be set to a negative number.

Half guy

The little half guy picture is for selecting whether or not the animation is mirrored.

Blue box

This is a visualizer for the animations in your blend tree. You can use it to better visualize how your animations work with PosX and PosY.

The blue diamonds are your animations and are placed to where their X and Y positions are in the below table.

The red circle in the middle represents where the current X and Y positions are. You can move any of these by clicking and dragging them.

Replacing a part of a Blend Tree

First thing’s first, ALWAYS KEEP BACKUPS

duplicate the blend tree that you want to edit. The default blend trees are held inside:

“Assets/VRCSDK/Examples3/Animation/BlendTrees”

And the one we’re looking for in this example is named “vrc_StandingLocomotion”

Duplicate it by clicking on the blend tree in your project tab and press Ctrl+D.

Now that we have our new blend tree, rename it to something like “[your avatar]_Standing” and move it into the folder that you want. We can now replace the animation you want to change inside that new blend tree in this menu:

This menu is inside the “Inspector” tab

You can now replace the old Blend Tree in controller with the new one we’ve edited and assign the controller to your Base Layer.

Replacing the Blend Tree

Replacing the Blend Tree is very easy. Just replace the Motion in the Base Animation Controller with the animation that you want to. Just note, this will replace not only your idle animation, but also your walking animation aswell. I recommend either making a new blend tree (which is outside the current scope of this tutorial) or go back to the above section and just replace the Idle animation of the existing Blend Tree.

Join the Discord server if you want to be kept up to date with new releases.