Play the demo
Before wiring the component into your own game, run the included example so you know which Blueprints and inputs are involved.
sequenceDiagram
participant Player as FirstPersonCharacter
participant Input as InputActionStartTargeting
participant AAC as Auto Aim Component
participant NPC as ThirdPersonCharacter_NPC
Player->>Input: Press (hold)
Input->>AAC: Start Trace
AAC->>NPC: Box trace hits pawn
AAC-->>Player: On Auto Aim Started
loop Event Tick while locked
Player->>AAC: Set Look At Start / Target Location
AAC->>Player: Smooth controller rotation
end
Player->>Input: Release
Input->>AAC: End Trace
AAC-->>Player: On Auto Aim Ended
Open the example map
Section titled “Open the example map”- Add Auto Aim Component from FAB and open the project in Unreal Engine.
- The editor should load AutoAimComponentExampleMap (
Content/AutoAimComponent/Map/AutoAimComponentExampleMap). - Press Play (PIE).
The level places FirstPersonCharacter as the player and four ThirdPersonCharacter_NPC instances as lock-on targets.
Example: basic lock-on
Section titled “Example: basic lock-on”This mirrors the default demo wiring.
- Look at a mannequin NPC within roughly 3000 units.
- Press and hold the Start Targeting input (InputActionStartTargeting on FirstPersonCharacter).
- The camera smoothly rotates toward the closest skeletal socket on the hit pawn (default Interp Speed
10). - Release Start Targeting — lock ends and End Trace runs.
If you aim at empty space and press Start Targeting, On Auto Aim Failed fires instead of a lock.
Controls in the demo
Section titled “Controls in the demo”| Input | Blueprint hook | What happens |
|---|---|---|
| Start Targeting (pressed) | InputActionStartTargeting → Start Trace | Box trace from camera; acquire pawn target |
| Start Targeting (released) | InputActionStartTargeting → End Trace | Stop targeting |
| Turn / Look Up (mouse) | Axis events → Free Look + Try Cancel Auto Aim From Input | Offset aim or break lock when looking away |
| Fire | Separate projectile logic | Demo weapon — not part of auto-aim |
Example: compare trace presets
Section titled “Example: compare trace presets”Use these on the Auto Aim Component attached to FirstPersonCharacter, then PIE and hold Start Targeting on the same NPC at the same distance.
| Step | Trace Distance | Trace Size | What you should notice |
|---|---|---|---|
| 1 | 3000 | 100 | Baseline — demo default |
| 2 | 4000 | 150 | Easier to acquire from farther / off-center |
| 3 | 2000 | 60 | Must aim closer and more directly at the NPC |
Enable Draw Trace temporarily to visualize the box in the viewport.
What to inspect after playing
Section titled “What to inspect after playing”| Asset | Why open it |
|---|---|
| FirstPersonCharacter | Auto Aim Component child, Start Trace / End Trace, per-tick look-at, event bindings |
| ThirdPersonCharacter_NPC | BPI_AutoAim + Get Skeletal Mesh Component |
| AutoAimComponent | Trace logic, Start Trace / End Trace events, default properties |
| BPI_AutoAim | Interface required on aimable actors |
Next steps
Section titled “Next steps”- Add lock-on to your character — worked example reproducing FirstPersonCharacter
- Make an aimable target — worked example for ThirdPersonCharacter_NPC
- Example presets — quick property combinations