---
description: In this chapter we will cover how to replace existing weapons.
---

# Replacing Weapons

{% hint style="success" %}
**Note**: Blender software is required for this tutorial.
{% endhint %}

Replacing weapon models from the **FPS Animation Pack** consists of 2 parts:

1. Adjusting custom weapon's bones and rigging
2. Importing the new weapon to the project.

## Weapon rigging

First, we need to import our weapons into a fresh Blender project:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2FUnrfGhGSpZCybzOogJsi%2Fimage.png?alt=media&#x26;token=273823de-91d9-457c-b552-5502d2c58fd1" alt="" width="563"><figcaption><p>The bottom model is what we want to replace</p></figcaption></figure>

If your model already contains a skeleton, make sure to remove it:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2Fud2GmMhVxYorlb39KJfs%2Fimage.png?alt=media&#x26;token=aa0bc783-f16e-428f-bce0-a28ea770d281" alt="" width="250"><figcaption><p>Select the weapon's armature and delete it.</p></figcaption></figure>

We will use a skeleton from the model we want to replace. This is needed to ensure that both weapons have the same hierarchy so animations can be played without any issues.

Next, we need to create vertex groups for our custom weapon. To do this, right-click on the model and press Tab to activate the "**Edit**" mode. Select the "**Object Data Properties**" icon:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2FhCOwBWBWEzlaY57laxW2%2Fimage.png?alt=media&#x26;token=b07ff17a-cfdc-40a2-8777-5521d5e38a1b" alt="" width="417"><figcaption><p>Object data properties.</p></figcaption></figure>

Now you should see the "Vertex Groups" list on the right:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2FqnGNpQ6kZHnoX90niswB%2Fimage.png?alt=media&#x26;token=3f2a47eb-0ed1-43de-b2ce-f239d7b3534e" alt=""><figcaption><p>Vertex groups.</p></figcaption></figure>

These groups define parts of the mesh that will be bound to the skeleton bones. To create a new group, right-click on the "**+**" icon and set its name to the target bone. It is important to first see what vertex groups are present in the source model and then re-create such groups in your custom model.

Now, we need to assign parts of the weapon to our newly created groups. Here is how to do it step-by-step:

1. Left-click on the vertex group.
2. Select the part of the weapon you want to include.
3. Click the "Assign" button.

Once all parts are assigned, we need to parent our custom model to the target skeleton. To do this, make sure to align weapons:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2F6n4aHLsXNzjLK2A5PNYy%2Fimage.png?alt=media&#x26;token=42e8dac7-9b97-42ea-a547-925ffc579998" alt="" width="563"><figcaption><p>Perfectly aligned weapons.</p></figcaption></figure>

Next, select your custom weapon model, then the target skeleton, and press **Ctrl + P**, select the "**Armature Deform**" option:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2FRZEO3yKy6Msrnf360bC4%2Fimage.png?alt=media&#x26;token=4eb24e72-2d85-4170-b664-9bef749d7053" alt="" width="563"><figcaption><p>Parenting model to the skeleton.</p></figcaption></figure>

To export your model as **FBX**, go to <mark style="background-color:purple;">**File → Export → FBX**</mark>. Make sure to use these settings:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2F01it6NoYFp0yMicU8Hen%2Fimage.png?alt=media&#x26;token=573e003a-037e-4f6c-afb2-e5e4f67e653d" alt="" width="227"><figcaption><p>Export settings.</p></figcaption></figure>

## Importing to Unity

To import a custom model, <mark style="background-color:purple;">**right-click → Import Asset...**</mark>. Once the model is imported, we need to modify the weapon prefab in <mark style="background-color:purple;">**FPSAnimationPack → Prefabs**</mark>. Add your new model to the prefab, and copy these components from the old model:

<figure><img src="https://2885832619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTutPE4k64wSsZ71G3Yf0%2Fuploads%2F5XmAD6zxq2q4XOtX2wZ2%2Fimage.png?alt=media&#x26;token=b51e95ab-59ee-4b6c-8c10-f7efbecda774" alt="" width="369"><figcaption><p>Weapon components.</p></figcaption></figure>
