> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinemation.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 📘Player Blueprint

> In this page you will learn how the system works in general.

## Basics

The *FPS Animation Pack* offsers an example **BP\_Viewmodel** character blueprint, which is a playable character used in the demos. This character blueprint has a modular structure:

<Frame caption={"BP_Viewmodel character."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/7bf2ab352fa924777780.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=73f4a74abc4a38153f611f10ff2f9a56" alt="" width={416} data-path="images/fps-animation-pack/unreal/7bf2ab352fa924777780.png" />
</Frame>

While it contains basic components and properties like any other character, BP\_Viewmodel has distictive features:

* **Camera** - parented to the *FP\_Camera* socket, which is parented to the head bone.

* **WeaponMesh** - *SkeletalMeshComponent* used for currently equipped weapon.

* **CameraAnimator** - used to play camera animations and recoil shakes.

* **ViewmodelController** - used as an interface between the gameplay and animation blueprints.

* **Recoil Animation** - used to play procedural firing animations.

* **Weapon Manager** - used to handle weapon creation and swapping logic.

We will cover each component in detail in the next chapters. The **BP\_Viewmodel** is responsible for general gameplay logic, like movement and player rotation. All actions that depend on a weapon are handled via *Event Dispatchers*:

<Frame caption={"All events used by the character blueprint."}>
  <img src="https://mintcdn.com/kinemation/PlmzVQHJ3J_C1x92/images/fps-animation-pack/unreal/4ef713b8ecd27a259a95.png?fit=max&auto=format&n=PlmzVQHJ3J_C1x92&q=85&s=6bbf5ab2c0b6d0b7967c85b8eb2d837a" alt="" width={404} data-path="images/fps-animation-pack/unreal/4ef713b8ecd27a259a95.png" />
</Frame>

<Tip>
  **Tip**: you will find all the main logic implemented in the Event Graph.
</Tip>

For example, when a user wants to reload a weapon, the **BP\_Viewmodel** is only going to receive the input, and then invoke the bound event:

<Frame caption={"Reload action example."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/a00ad44b0150f2f44595.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=7f741d8615c498c4bea163f9287d1152" alt="" width={344} data-path="images/fps-animation-pack/unreal/a00ad44b0150f2f44595.png" />
</Frame>

Now let's focus on the logic implemented by the **BP\_Viewmodel**.

## Initialization

Before the game starts, **BP\_Viewmodel** tries to add a custom Input Mapping Context to our Player Controller:

<Frame caption={"Adding Input Mapping Context."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/ee8e85d5e7ebfe213856.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=d355bf381f72d137ecf4624d791f4c83" alt="" width={563} data-path="images/fps-animation-pack/unreal/ee8e85d5e7ebfe213856.png" />
</Frame>

This will make sure our custom are registered, so our gameplay actions can be executed. Next, we need to spawn the weapons:

<Frame caption={"Weapon Manager handles weapon instantiating logic!"}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/7589e53755a612add7ad.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=dd7e1ab8030acf8bd109aa1f39386c91" alt="" width={476} data-path="images/fps-animation-pack/unreal/7589e53755a612add7ad.png" />
</Frame>

Here we use the **Weapon Manager** component to initialize all weapons based on the character settings provided by the **Viewmodel Controller** component. The latter is responsible for switching between UE4 and UE5 Mannequins, each of the Skeletons have unique animation sets and blueprints.

## Movement

Character's speed and gait are updated in **Tick** - `Update Movement` function:

<Frame caption={"Movement is updated every tick."}>
  <img src="https://mintcdn.com/kinemation/PlmzVQHJ3J_C1x92/images/fps-animation-pack/unreal/46789fdeda75bf3c1b0c.png?fit=max&auto=format&n=PlmzVQHJ3J_C1x92&q=85&s=25126890e9d8997c1ba875e84a8978db" alt="" width={309} data-path="images/fps-animation-pack/unreal/46789fdeda75bf3c1b0c.png" />
</Frame>

This function computes the character max speed and sets it via the **Character Controller:**

<Frame caption={"Speed update."}>
  <img src="https://mintcdn.com/kinemation/PlmzVQHJ3J_C1x92/images/fps-animation-pack/unreal/3f50b2c447bee1a504d4.png?fit=max&auto=format&n=PlmzVQHJ3J_C1x92&q=85&s=63476faa5327908cc3730687144f41fb" alt="" width={295} data-path="images/fps-animation-pack/unreal/3f50b2c447bee1a504d4.png" />
</Frame>

Here we also compute the **Gait** parameter - it is used in the animation blueprints to blend between idle, walk, sprint and tactical sprint states.

<Frame caption={"Gait update."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/e05457c9aac01021f548.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=838372de15b24776f927493416b41637" alt="" width={269} data-path="images/fps-animation-pack/unreal/e05457c9aac01021f548.png" />
</Frame>

Because **ViewmodelController** is used as a data interface between gameplay and animation logic, the gait value resides in this component.

***

Now it is time to find out how the weapon system works.
