How-To: Add Camera Lag & Recenter
Goal: make the camera body trail smoothly (lag) and return behind the character (recenter) - both off by default on the third-person mode.
Prerequisites
Your active mode is a
UCrimsonCameraMode_ThirdPerson subclass.1. Enable lag and auto-recenter (mode properties)
Lag and auto-recenter are toggled by properties on the mode - set them once in the mode's Details (Blueprint) or constructor (C++). Lag smooths the view, never the control rotation, so aiming stays crisp.
Verify
Moving the pawn makes the camera trail and ease in; standing idle then moving re-centers the view behind it.
2. Recenter on demand
Call Recenter Camera (e.g. on a button) to snap-behind once. It works whether or not auto-recenter is enabled. Recenter is a per-mode method (unlike shoulder/zoom, which are on the component), so fetch the live mode instance with Get Camera Mode Instance and cast it to your third-person mode first.
Verify
Pressing the button smoothly rotates the camera to directly behind the character.
Change these at runtime
To let players toggle lag / recenter from an options menu, use the runtime setters (
Set Camera Lag Enabled/Speed, Set Auto Recenter Enabled/Delay/Interp Speed) on the active mode instead of setting them once. See How-To: Expose Camera Options as User Settings.See also
- How-To: Expose Camera Options as User Settings - drive lag / recenter live from a player menu.
- Concept: The Mode Stack & Blending - lag and recenter are per-mode-instance state.