# Third-Person Setup

This page walks through a complete third-person look & aim setup for either player characters or NPCs. 

If you have not yet installed FocalRig, created a Control Rig with an imported hierarchy, and connected it to an Animation Blueprint, see [Quick Start](/?id=quick-start).

## 1. Add an Aim Control in the Control Rig

1. In the Control Rig, <span class="fr-term" tabindex="0" data-tooltip-key="add-control">add a control</span> named `aim_ctrl`.
<br>![aim_ctrl in Rig Hierarchy](_media/aim-ctrl-in-rig-hierarchy.png ':size=400px')
2. Set its "Value Type" to "Position" and set Initial Location to a value in front of the character's head.
<br>![aim_ctrl details](_media/aim-ctrl-details.png ':size=400px')
3. Drag the control into the graph to make a "Get Control Vector" node, then connect it to a "From World" node.
<br>![Get Control Vector reading aim_ctrl](_media/aim-ctrl-get-global.png ':size=400px')

## 2. Add a GetFocalPoint function in the Animation Blueprint

1. In the Animation Blueprint, make a function named `GetFocalPoint`. 
2. Mark as pure and const, and give it a vector return value
3. Inside the function, call `Try Get Pawn Owner`, pass it into [Get Focal Point Of Pawn](get-focal-point-of-pawn.md), and return the result.
<br> ![GetFocalPoint function](_media/third-person-get-focal-point-function.png ':size=1200px')
4. In the Anim Graph, connect `GetFocalPoint` to the Control Rig node's `Aim Ctrl` pin through <span class="fr-term" tabindex="0" data-tooltip-key="property-access">Property Access</span>. If the pin is missing, select the Control Rig node and enable that pin in the "Input" category.
<br> ![GetFocalPoint function called via Property Access](_media/third-person-anim-graph-property-access.png ':size=400px')

## 3. Set a Preview Pose

Open the Control Rig. In the "Preview Settings" tab set "Preview Controller" to "Use Specific Animation" and select an "aiming forward" pose or loop.
This helps [Quick Setups](quick-setups.md) detect bone orientations correctly. [Aim Chain](aim-chain.md) snaps the aimed child's local forward axis to the local ±X/±Y/±Z axis closest to the <span class="fr-term" tabindex="0" data-tooltip-key="project-global-forward-axis">project global forward direction</span> in this pose, and [Aim Weapon](aim-weapon.md) does the same for the muzzle using the shoulder-to-muzzle direction.

![Set Preview Animation in Control Rig Preview Settings](_media/controlrig-set-preview-animation.png ':size=400px')

## 4. Build the Control Rig

![Simple third-person Control Rig](_media/simple-third-person-controlrig.png)

### 4.1. Core Setup

1. Feed `aim_ctrl` through `From World` into [Clamp Aim Target](clamp-aim-target.md).
2. Connect Clamp Aim Target's `Result` pin to [Aim Chain](aim-chain.md)'s `Target` pin.
3. If the character uses a weapon, connect the clamped target to [Aim Weapon](aim-weapon.md)'s `Target` pin. If its [Quick Setup](aim-weapon.md?id=quick-setup) does not detect a good muzzle element, follow [Creating a Muzzle Element](aim-weapon.md?id=creating-a-muzzle-element).

### 4.2. Dynamic Settings

1. If you want to dynamically switch between aiming and not aiming, make a public boolean variable named `IsAiming` and connect it to the `Weight` pin on Aim Weapon through [Smooth Toggle](smooth-toggle.md).
2. If you want to use [Aim Down Sights](aim-weapon.md?id=aim-down-sights), make a public boolean variable named `IsAimingDownSights` and connect it to Aim Weapon's `Aim Down Sights > Weight` through Smooth Toggle.
3. If you want to use [Weapon Kick](aim-weapon.md?id=kick), make a public time variable named `TimeOfLastShot` and connect it to Aim Weapon's `Kick > Time Of Last Shot`.
4. If you want to use [Aim Lock](aim-weapon.md?id=aim-lock-weight), read a curve that spikes during a shooting animation (e.g., "Recoil") and connect it to Aim Weapon's `Aim Lock Weight`.
5. If you want to use [Spray](spray.md), make a public integer variable named `ShotsFiredInBurst` and connect it to `Spray > Shots Fired In Burst`. That value should come from your gameplay logic and represents how many shots have been fired so far in the current burst.

In the Animation Blueprint, the public variables you created will show up as pins. Connect them through <span class="fr-term" tabindex="0" data-tooltip-key="property-access">Property Access</span> from the gameplay state of your character:

![Third-person Control Rig inputs in Anim Graph](_media/third-person-control-rig-in-abp.png ':size=600px')

If any pins are missing, make sure the variables are public and then select the Control Rig node and enable them in the "Input" category. 

### 4.3. Optional: Aim Eyes

If you also want eye aiming, add [Aim Eyes](aim-eyes.md) after the nodes above and connect the same clamped aim target to it.
