How-To: Set Up Lock-On
Goal: lock the camera onto a target (with multiple lock points), switch targets by screen direction, and cycle lock points.
Prerequisites
The Gameplay Targeting System is enabled (it is, via CrimsonCamera). You have a pawn with a
UCrimsonCameraComponent and at least one lockable actor.1. Build a targeting preset
The preset decides who can be locked. It's a data asset - author it in the editor; there is no C++ step. Add tasks in order: selection, then filters, then a sort.
Data-driven
Reorder, add, or disable tasks to change targeting with no recompile. The Team Affiliation task lives in CrimsonCore - on the full Crimson stack it's available automatically; standalone, drop in your own affiliation filter or omit it.
Verify
Open the preset - the tasks list reads Selection -> filters -> sort. If there is no selection task it will match nothing; the
Crimson.Camera.DevTools Preset tab flags this.2. Create a lock-on config
UCrimsonLockOnConfig bundles the preset, the lock-on camera mode, and tunables. Make a Blueprint child of UCrimsonCameraMode_LockOn for the mode class.
Verify
The config asset has its Targeting Preset and Lock On Camera Mode Class both assigned - an unset mode class means lock-on has no camera to push.
3. Add the components and lock points
Put a UCrimsonLockOnComponent on the player (assign the config), and a UCrimsonLockOnTargetComponent on each lockable actor (fill its LockOnPoints with mesh sockets - several sockets = cycle-able weak points).
Verify
In PIE, the
Crimson.Camera.DevTools Targets tab lists each lockable actor with Lockable = Yes. An actor missing its target component shows Lockable = No.4. Bind input
The lock-on component exposes Blueprint-callable actions. Bind your Enhanced Input to them.
Verify
Press lock -> the camera frames the target; flick the switch input -> it swaps to the screen-direction target; cycle -> it re-aims between the target's sockets.
See also
- How-To: Show Lock-On Indicators - draw the on-screen markers over targets.
- How-To: Soft Lock-On - action-combat continuous targeting on top of this setup.
- Concept: Lock-On Pipeline - how the targeting preset, component, and camera mode fit together.
- Lock-On Reference (in API Reference) - the indicator widget, settings, and config flags.