🔶Layers setup
In this section we will set up animation layers.
Last updated
In this section we will set up animation layers.
Last updated
You can add and remove layers by using "+" and "-" buttons in the Layers tab. You can also copy/paste layers by clicking on the header:
In this tutorial, we will add all the basic animation layers:
First, you need to create an Avatar Mask, which will include the left hand only. This mask will be used to manually override fingers' rotation in runtime:
Now add a Left Hand IK Layer to the FPSAnimator:
Set the Curve Name to MaskLeftHandIK - this is a float parameter from the Animator Controller, which is used to disable the Left Hand IK via a curve. You can add a MaskLeftHandIK curve to your animation, like sprinting, and it will smoothly blend out the Left Hand IK Layer.
Set the Mask Curve Name to MaskLeftHand - the same as MaskLeftHandIK, but it will be used with dynamic animations, like reloads, grenade throws, etc.
Set the Left Hand Mask to the Avatar Mask we just created.
Add the AdsLayer to the FPSAnimator and set these properties:
Set the Aim Target to the FPCameraSocket we created earlier. The aim target will be used to align the weapon Aim Point.
Set the Crouch Pose Curve to the CrouchWeight. This curve will blend it the crouch offset when crouching.
Add Recoil and Slot layers to the FPSAnimator. The Recoil layer will extract recoil from the RecoilAnimation component we added in the beginning, and Slot layer will apply IK transition motions. They are used when crouching, jumping and aiming.
These layers do not require any setup, so let's just go to the next layer.
Add the Sway Layer and make sure to specify the head bone. It will be used for dead-zone or free aiming feature:
This layer will apply movement and aiming sway, as well as free aiming feature.
Add the Locomotion layer. This layer controls the animation blending, and also applies procedural curve animations:
Set the Curve Name to FullBodyWeight - this will make sure the full body is overidden by the animator only, which is useful when you want to play sprinting for example.
Set the Ik Interpolation to 25 or any other value - this will define the smoothing speed for all curve animations (idle, walking, equip, unequip, etc.).
Add the Look layer to the FPSAnimator:
Make sure to set the LerpSpeed and Pelvis Lerp Speed to some values - this will ensure smooth transitions. Also, set the Layer Alpha to 1.
Also set the Lean Amount and Lean Speed properties in the Leaning tab:
Now we need to create an Aim Offset Table for your character - a Scriptable Object, which contains bone indices and angles:
To create a new Aim Offset Table, follow these steps:
Enable Auto Distribution.
Add bones to the Look Up/Right Offset lists.
Adjust the bone angles.
Click the Play button to preview the animation in the editor.
Adjust Aim Up/Right slider values to see how the look layer rotates the bones.
Finally, hit the Save Table button to generate/save exisiting asset.
This is the last layer we will add, you only need to specify the Layer Mask, which will be used for the raycast:
At this point, we've comleted the animation layers setup, and in the next chapting we will set up our player controller.