While working on ComboGestureExpressions 1.4, I had a lot of struggles with Write Defaults OFF. I have consolidated everything I’ve learned along the way on this page.
<aside>
⚠️ The article below was written in March 2021.
Research on this subject has evolved since then, and as of September 2023, I recommend you read this other article instead.
https://notes.sleightly.dev/write-defaults/
</aside>
Animating non-muscle transforms
Write Defaults is a tricky topic. According to the VRChat Documentation, it recommends that in general:
- Write Defaults should be OFF.
- Transform animations belong in the Gesture Playable Layer.
- Muscle animations belong in the Gesture Playable Layer.
- Anything that is not a Transform animation nor a Muscle animation belong in the FX Playable Layer. This includes all Constraint component animation curves and GameObject toggles.
For Transform animations to work in the Gesture Playable Layer:
- The first mask of the Gesture Playable Layer must allow all Muscles and all Transforms that are animated by all the layers of the Gesture Playable Layer.
- The other masks of the Gesture Playable Layer should allow only the Muscles and Transforms that are animated by the layer on which the mask is on.
However, that is not sufficient. Transform animations in the Gesture Playable Layer will not animate if there is at least 1 layer in the FX Playable Layer that match these two conditions:
- If in the FX layer, there is at least 1 layer with 1 active state having Write Defaults OFF, and
- That layer has no Avatar Mask, or it has an Avatar Mask that does not deny all the transforms that are being animated.
Additional notes about non-standard configurations: The above is true regardless of whether the Gesture Playable Layer uses Write Defaults OFF. Also, if a layer in the FX Playable Layer only has states with Write Defaults ON, it should not interfere so it doesn’t need a mask.
Creating an Avatar Mask for the FX Layer
We need to create an Avatar Mask to add in the layers of the FX Playable Layer that match those two conditions. However, that Avatar Mask needs to be crafted carefully:
- If a layer has animations that animates references such as Material swaps, then the Avatar Mask must allow that transform in the mask. This is because the Material swap will no longer animate if it not allowed in the mask.
- In the real world, there are prefabs that animate Transforms in the FX Playable Layer. Therefore the mask must allow these unusual transforms in order not to break existing prefabs.