This document explains migration of the crosshair system of Crosshair Assembler with your project. We will use the UE4’s built-in first person demo as an existing project.
Add Crosshair Assembler to your project
First thing to do is to add the Crosshair Assembler pack into your project in the Epic Games Launcher.
If the pack is correctly included in your project, the content browser should have “CrosshairAssembler” 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 CrosshairAssembler/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 Assembler 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 Assembler 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 Assembler’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 CrosshairAssembler/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.