Concept: Lock-On Pipeline
Lock-on is built on Unreal's Gameplay Targeting System so the who-can-I-lock logic is a data-driven, reorderable pipeline rather than hard-coded. CrimsonCamera adds only the lock-on-specific layer on top.
The flow
- Acquire -
UCrimsonLockOnComponentbuilds a targeting request (source = the pawn) and runs the config'sUTargetingPresetthrough theUTargetingSubsystem. - Filter & sort - the preset's tasks select candidates (AOE), drop the invalid ones (not lockable, wrong team, no line of sight), and sort the rest (distance / screen-centre).
- Pick - the component takes the best result, finds its
UCrimsonLockOnTargetComponent, and chooses a lock point (the highest-priority socket). - Frame - it pushes
UCrimsonCameraMode_LockOn, which drives the control rotation toward that lock point each frame (smooth blend, pitch clamp, teleport snap). - Maintain - a tick loop re-resolves the point and breaks the lock if the target is gone, unlockable, out of range, or out of sight.
Why one result per actor, but many lock points
The Targeting System returns one result per actor, so the lock points (head, torso, weak spots) live on the target's UCrimsonLockOnTargetComponent as a list of sockets. That's what makes weak-point cycling possible - the camera system owns the points; the targeting system owns the candidate selection.
UCrimsonLockOnFragments to the config to react to lock events (reticle, slow-mo, SFX) without subclassing the core, and override Compute Desired Lock Rotation on the mode for custom framing.Hard vs soft lock
The same component also drives soft lock (opt-in via settings). Instead of committing a target and taking over the camera, it re-runs the same preset on an interval and, with stickiness (score margin + min dwell), tracks the screen-centre-most enemy while you are not hard-locked - exposing it via Get Current Lock On Target for attacks to face / home toward. Hard lock always supersedes soft: committing a hard lock clears the soft target, suppresses soft evaluation, and (for the optional assist mode) yields the override stack, so the two never fight. See How-To: Soft Lock-On.