# Character setup

## Import the character

We are going to use a Swat character from the [**Mixamo website**](https://www.mixamo.com/)**:**

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F5GwIZV0pKhRhL4fq0cg8%2Fimage.png?alt=media&#x26;token=a7d51b5a-04d1-4b39-a898-32e434799486" alt="" width="563"><figcaption><p>Download the character and import it to the Unity project.</p></figcaption></figure>

Import the character to your project and click on the FBX file. Set the **Animation Type** to *Humanoid*, and **Avatar Definition** to *Create From This Model*:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FVYjkEpZI1Vi4joBYqhMT%2Fimage.png?alt=media&#x26;token=83e3e41e-d324-4952-9f01-e14ac1f58263" alt="" width="390"><figcaption><p>Animation settings for Swat character.</p></figcaption></figure>

{% hint style="info" %}
**Tip:** You can also use the *Generic* animation type, for the system it doesn't matter whether the model is *Generic* or *Humanoid*. But keep in mind: *Generics* can not be retargeted! This means you can't share animations, unlike with *Humanoids*.
{% endhint %}

## Add components

Drag your character to the scene and add the **Animator** component:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FxxNCEIV5gIcaD4qEl6QI%2Fimage.png?alt=media&#x26;token=8ab9cb6f-0ba9-40d9-a687-18e5abcf55a1" alt="" width="362"><figcaption><p>Specify these settings.</p></figcaption></figure>

Choose the **IKRigAnimator\_Humanod** as a Controller. This is a demo animator controller, which already includes all the character animations.

Now, let's add a **Bone Container** component to the Hip/Pelvis bone:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F8iQWYUkg1epVBD1TR7TM%2Fimage.png?alt=media&#x26;token=32681b3c-0066-4a9c-908d-d143ae42c5b7" alt="" width="311"><figcaption><p>Add this to your character root.</p></figcaption></figure>

**Bone Container** will find all the character bones when added. It's required, if you character is modular, just like our Swat model:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F14CM9aGDnCvB5dOYy43I%2Fimage.png?alt=media&#x26;token=61ca9481-e266-430f-8254-c7c4beba30c6" alt="" width="282"><figcaption><p>Modular character example.</p></figcaption></figure>

Now we need to add <mark style="color:purple;">RecoilAnimation</mark> and <mark style="color:purple;">AnimEventReceiver</mark> components directly to the character:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FJKquZ76Wiy2GvEmc74lj%2Fimage.png?alt=media&#x26;token=4887efa3-889d-40dc-b1f8-cb0108a395d0" alt="" width="369"><figcaption></figcaption></figure>

<mark style="color:purple;">RecoilAnimation</mark> will generate smooth weapon recoil, while <mark style="color:purple;">AnimEventReceiver</mark> will process animation events.

## Add FPS Animator

Finally, we have to add the **FPS Animator** component - it's responsible for all animation logic in the system. Think of it as a central hub, that contains all the animation layers and applies them in realtime.

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FD69mnwlXfULN67QpJV6u%2Fimage.png?alt=media&#x26;token=a402c7eb-a13c-42b5-bee1-8961860370f6" alt="" width="408"><figcaption><p>FPS Animator inspector.</p></figcaption></figure>

You will see a lot of warnings under the **Setup IK Rig** button:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FA9FOjhx5y7Vkkg1Q7q3W%2Fimage.png?alt=media&#x26;token=2d4dd3fb-3a58-430e-8aed-cc41d75adcf6" alt="" width="385"><figcaption><p>The system doesn't have references assigned for these bones!</p></figcaption></figure>

To fix this, simply press the **Setup IK Rig** button. The system will automatically find all the bones and create IK objects.

{% hint style="info" %}
**Tip:** sometimes this might fail, if the names are unusual or there's a problem with the avatar. If that's the case, you will need to manually assign and create bones mentioned in the warning log.
{% endhint %}

## Create an Upper Body Mask

Now we need to create a new Avatar Mask, which will only include the upper body part of the character.

Create a new Avatar Mask by **Right Click -> Create -> Avatar Mask** and name it UpperBody:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F6yrzRjPXphD7EyDibsdu%2Fimage.png?alt=media&#x26;token=a21c79f5-ad42-486a-adcc-767f259ae489" alt="" width="224"><figcaption><p>Upper Body Humanoid mask.</p></figcaption></figure>

If you have a generic character, you will need to manually specfiy the bones in the Transform category:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FsTH3JOzhtAvyADKkRKw5%2Fimage.png?alt=media&#x26;token=22847408-d435-453c-b8a6-b552069600e1" alt="" width="366"><figcaption><p>Use this for Generics.</p></figcaption></figure>

## Create First Person Animator Controller

Create a new Animator Controller (**Right Click -> Create -> Animator Controller**) and name it **FirstPersonAnimator\_Tutorial.** We will use this controller to play procedural walking and idle animations.

To do so, we need to create another Avatar Mask, which will animate the WeaponBoneAdditive only.&#x20;

Create an empty Avatar Mask first, then add an empty GameObject to the rootBone and name it WeaponBoneAdditive:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FIdmrJ0ExCD8545XsbYkA%2Fimage.png?alt=media&#x26;token=54014506-dd04-4d25-8bb8-b97f76a91ef6" alt=""><figcaption></figcaption></figure>

Then, open up your Avatar Mask and go to the Transform category. Then import your character avatar and toggle all bones off:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FMSHCS0uiWX2lCHmnhB7N%2Fimage.png?alt=media&#x26;token=7d96b873-c28b-4256-9126-bd6253e4ebd6" alt="" width="368"><figcaption></figcaption></figure>

Finally, we need to use a framework tool to add a custom bone. Go to the **Window/FPS Animation Framework/FPS Animator Utility/Avatar Mask Modifier**:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2F4JjLyxVZObM42HbrNVhO%2Fimage.png?alt=media&#x26;token=4e0a5bd9-44cf-4e22-a04e-a94578c60576" alt="" width="485"><figcaption><p>Click the Add Bone button.</p></figcaption></figure>

And that's how your Avatar Mask will look like:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FE7xwqFwKvCnnlJQViQ36%2Fimage.png?alt=media&#x26;token=41a52d76-848f-4921-b161-f8e8049e1442" alt="" width="238"><figcaption><p>Final result.</p></figcaption></figure>

## Finalizing the setup

Open your <mark style="color:purple;">FPSAnimator</mark>, Anim Graph tab and assign the Upper Body mask and the First Person Animator we created earlier:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FHPonvwvweZ5gbILvgATi%2Fimage.png?alt=media&#x26;token=c3460941-4984-4863-aa79-75d2b1354e80" alt="" width="359"><figcaption></figcaption></figure>

Now you can go to the Layers tab and hit the Play button. It will preview the currently selected animator. If you want to preview a specific animation, make sure to specify the clip:

<figure><img src="https://3983499731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxsGuM7QMKoTm8rnHX3cO%2Fuploads%2FYal90doKBkRsIwOPV4nP%2Fimage.png?alt=media&#x26;token=fde30acf-f6d1-40c1-a180-8eb0380ea9ff" alt="" width="343"><figcaption><p>You can also loop the preview.</p></figcaption></figure>

The next step is camera setup.
