FPS Animation Pack Unity
  • 👋README
  • tutorials
    • 💻Installation
    • 📚Overview
    • ↗️BiRP, URP and HDRP
    • 🎯Retargeting Animations
    • Replacing Weapons
    • 🏃‍♂️Procedural Animation
    • ➕FPS Animation Framework Integration
  • Gameplay
    • 📘Player Prefab
    • 🔫Weapon System
    • 🔉Sound Effects
  • animations
    • 🦾Character
    • 🔫Weapon
    • 📷Camera
    • 💥Recoil
Powered by GitBook
On this page
  • Weapon rigging
  • Importing to Unity
  1. tutorials

Replacing Weapons

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

PreviousRetargeting AnimationsNextProcedural Animation

Last updated 2 months ago

Note: Blender software is required for this tutorial.

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:

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

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:

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

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:

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

To export your model as FBX, go to File → Export → FBX. Make sure to use these settings:

Importing to Unity

To import a custom model, right-click → Import Asset.... Once the model is imported, we need to modify the weapon prefab in FPSAnimationPack → Prefabs. Add your new model to the prefab, and copy these components from the old model:

The bottom model is what we want to replace
Select the weapon's armature and delete it.
Object data properties.
Vertex groups.
Perfectly aligned weapons.
Parenting model to the skeleton.
Export settings.
Weapon components.