
So you found a cool AFK animation but you don't know how to add it to your VRChat avatar? Don't worry - even I found adding it tricky and I had to watch a couple of YouTube videos to get it. Here is a quick tutorial to help you.
This tutorial assumes you have experience with Unity and the animation system (ie state machines).
Animations that affect your IK skeleton need to be placed into the "Action" playable layer of your VRChat avatar. Click your avatar, scroll down to the "Playable Layers" section and create one if you do not have it.
VRChat tells our animator when we are AFK by setting the parameter "AFK" from false
to true
. Click the "Parameters" tab and add a new parameter called "AFK" of type "Bool".
In your Action animator controller (the "playable layer") add a new layer called "AFK". Create a default state (the yellow one) called "Not AFK".
Create a new state called "Enabled". Create a transition between the default state and the "Enabled" state. The condition must be that "AFK" equals "true".
To make our animation override the IK system we need to tell VRChat to disable tracking. Add a new behavior to your state called "VRC Animator Tracking Control". Click "All" for animation.
VRChat sets the "weight" of your Action playable layer to 0 (for some reason). We must tell VRChat to set it to 1. Add another behavior called "VRC Playable Layer Control" and set the Goal Weight to 1. Set the Blend Duration to something like 0.5 (half a second).
Add a new state with your custom AFK animation and immediately transition to it.
Set the transition duration TO this state to your Blend Duration (ie 0.5) and set the Exit Time to 0.01 to ensure the skeleton transitions smoothly.
When we are no longer AFK we need to resume tracking and reverse our change to the weight of our playable layer. Add a new "Disabled" state, transition to it only when "AFK" is set to "false" and reverse everything we have done.