Player Blueprint
In this page you will learn how the system works in general.
Last updated
In this page you will learn how the system works in general.
Last updated
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:
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:
Tip: you will find all the main logic implemented in the Event Graph.
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:
Now let's focus on the logic implemented by the BP_Viewmodel.
Before the game starts, BP_Viewmodel tries to add a custom Input Mapping Context to our Player Controller:
This will make sure our custom are registered, so our gameplay actions can be executed. Next, we need to spawn the weapons:
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.
Character's speed and gait are updated in Tick - Update Movement
function:
This function computes the character max speed and sets it via the Character Controller:
Here we also compute the Gait parameter - it is used in the animation blueprints to blend between idle, walk, sprint and tactical sprint states.
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.