This document explains migration of the crosshair system of Crosshair Master with your project. We will use the UE4’s built-in first person demo as an existing project.
Add Crosshair Master to your project
First thing to do is to add the Crosshair Master pack into your project in the Epic Games Launcher.
If the pack is correctly included in your project, the content browser should have “CrosshairMaster” under Content folder like the following:
Applying Crosshairs in Your Project
Applying crosshairs to your project can be simply done by adding a crosshair actor to your level and adding some crosshairs into the crosshair actor’s crosshair list.
To do so, find the crosshair actor in CrosshairMaster/CrosshairMigration/BP_Crosshair and drag it into the level.
Then, click the added CrosshairActor and add a crosshair into its crosshair list.
Play to see the crosshair.
Applying Dynamic Recoil to the Crosshair
The crosshairs generated by Crosshair Master supports dynamic response to the weapon recoil. To enable it, we need to provide dynamic weapon recoil value to the recoil variable in the Crosshair Actor. Crosshair Master does not restrict the location where the weapon recoil is computed. That is it can be computed in the weapon, character controller, level, etc. Just once the value is passed to the crosshair actor’s recoil variable, the value affects the crosshairs for dynamic response.
Here, we compute the recoil value in the player controller, in the same way to the BP_CrosshairPlayerController which is used for the Crosshair Master’s Demo Scenes.
To demonstrate it, we will add a player controller class instance and name it CrosshairPlayerController. If you already have yours just use it.
Add the following node graph (can be found in CrosshairMaster/Demo/Blueprints/BP_CrosshairDemoPlayerController) to the player controller’s event graph. Please remove the event dispatcher nodes (InputAction_Fire_Pressed/Released) in the demo player controller’s graph for now. We will explain those dispatchers later.
Let the project use this player controller by changing the player controller in the world settings.
Play and fire (left click) to see the dynamic recoil response.