---
description: In this section we will set up animation layers.
---

# Layers setup

## General tips

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:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2Fc5PwokMcs4PIqSFnztFb%2Fimage.png?alt=media&#x26;token=ffa50602-ed0d-4f3f-8b8f-c6da74ba9476" alt="" width="404"><figcaption><p>You can copy layers from the demo prefabs.</p></figcaption></figure>

In this tutorial, we will add all the basic animation layers:

[#left-hand-ik](#left-hand-ik "mention")

[#a-ds-layer](#a-ds-layer "mention")

[#recoil-slot-layer](#recoil-slot-layer "mention")

[#sway-layer](#sway-layer "mention")

[#locomotion-layer](#locomotion-layer "mention")

[#look-layer](#look-layer "mention")

[#weapon-collision](#weapon-collision "mention")

## Left Hand IK

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:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FpwQez36BTXhc8SJMsbFG%2Fimage.png?alt=media&#x26;token=afd7fcf8-1c5e-4a9e-b61f-a0238009360b" alt="" width="374"><figcaption><p>Left Hand IK mask.</p></figcaption></figure>

Now add a **Left Hand IK Layer** to the FPSAnimator:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F53Mow3jYsHUnd8ipHNRK%2Fimage.png?alt=media&#x26;token=67ef4acf-476b-46d8-a1bd-50e7344296e2" alt="" width="361"><figcaption><p>Left Hand IK Layer.</p></figcaption></figure>

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.

## Ads layer

Add the AdsLayer to the FPSAnimator and set these properties:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FWkkHxOw1CXxn4n8ywaOr%2Fimage.png?alt=media&#x26;token=99ca075a-70d9-4809-b604-42c4aaf9fdef" alt="" width="367"><figcaption><p>Ads Layer.</p></figcaption></figure>

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.

## Recoil, Slot layer

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.

## Sway layer

Add the **Sway Layer** and make sure to specify the head bone. It will be used for dead-zone or free aiming feature:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FhoC0FeMGCKE506Q6HOvD%2Fimage.png?alt=media&#x26;token=d6402c82-bd08-44d1-be73-543627f11fec" alt="" width="365"><figcaption><p>Specify the head bone.</p></figcaption></figure>

This layer will apply movement and aiming sway, as well as free aiming feature.

## Locomotion layer

Add the Locomotion layer. This layer controls the animation blending, and also applies procedural curve animations:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FroRgxur7Y8wcbJLOg7xb%2Fimage.png?alt=media&#x26;token=3bfcc09f-13d0-4d53-bdee-340323e59df2" alt="" width="369"><figcaption></figcaption></figure>

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 I**k Interpolation** to 25 or any other value - this will define the smoothing speed for all curve animations (idle, walking, equip, unequip, etc.).

## Look layer

Add the Look layer to the FPSAnimator:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FfQrSAHsp5gPqD4zcIvvx%2Fimage.png?alt=media&#x26;token=4f248ddb-6e21-41f1-9cf1-dbd6a3c82d27" alt="" width="365"><figcaption></figcaption></figure>

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:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FHBfje0uL7hF6oZgR7rBk%2Fimage.png?alt=media&#x26;token=95c4069a-7dfb-4a98-9f08-e4afcf30e461" alt="" width="365"><figcaption><p>Leaning properties.</p></figcaption></figure>

Now we need to create an **Aim Offset Table** for your character - a Scriptable Object, which contains bone indices and angles:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2Fmc3QBu5AeJleGtM54zBi%2Fimage.png?alt=media&#x26;token=fac003a0-b29f-4c1a-a7e4-8d555c0b3219" alt="" width="370"><figcaption><p>Aim Offset Table.</p></figcaption></figure>

To create a new **Aim Offset Table**, follow these steps:

1. Enable Auto Distribution.
2. Add bones to the Look Up/Right Offset lists.
3. Adjust the bone angles.
4. Click the Play button to preview the animation in the editor.
5. Adjust Aim Up/Right slider values to see how the look layer rotates the bones.
6. Finally, hit the Save Table button to generate/save exisiting asset.

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2Fx8zMsjOlLsxu5CjNoXmS%2Fimage.png?alt=media&#x26;token=4f99f105-7816-4e14-bc0b-e499846560ea" alt="" width="419"><figcaption><p>Look layer setup.</p></figcaption></figure>

## Weapon Collision

This is the last layer we will add, you only need to specify the Layer Mask, which will be used for the raycast:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FFpF4xKEFHhroXvfhNVGL%2Fimage.png?alt=media&#x26;token=3124563a-9db1-48d0-b572-061b049b8bd3" alt="" width="398"><figcaption><p>Select the layer mask.</p></figcaption></figure>

At this point, we've comleted the animation layers setup, and in the next chapting we will set up our player controller.
