CrimsonCamera · Lesson 4 of 6
Framing & Feel
Before you start
- Completed: Your First Camera
- Your active mode is a UCrimsonCameraMode_ThirdPerson subclass
Chapters
1. Get the active mode instance
Shoulder, zoom, and recenter are methods on the third-person mode, so first fetch the live instance with Get Camera Mode Instance, passing the exact mode class you pushed, and cast it to third-person.
UCrimsonCameraMode_ThirdPerson* TP = Cast<UCrimsonCameraMode_ThirdPerson>(Cam->GetCameraModeInstance(UMyThirdPersonMode::StaticClass()));
2. Shoulder & zoom
if (TP){TP->ToggleShoulder(); // Center <-> Right/LeftTP->AddZoomDistance(ZoomAxis * 25.f); // clamped to [MinZoomDistance, MaxZoomDistance]}
Tune the limits on the mode
ShoulderOffset (default 50), MinZoomDistance (-150), MaxZoomDistance (400), and the interp speeds are properties on the third-person mode — set them in the mode's Details (Blueprint) or constructor (C++).3. Lag & recenter
Lag and auto-recenter are toggled by properties on the mode — set them once. Lag smooths the view, never the control rotation, so aiming stays crisp. Recenter Camera snaps behind on demand whether or not auto-recenter is on.
UMyThirdPersonMode::UMyThirdPersonMode(){bEnableCameraLag = true; CameraLagSpeed = 10.f;bEnableRecenter = true; RecenterDelay = 1.5f; RecenterInterpSpeed = 3.f;}// On a button, snap behind once:if (TP) { TP->RecenterCamera(); }
4. Camera shake
Play Camera Shake forwards to the owning player's camera manager. It's a no-op for non-player pawns or a null shake, so it's safe to call from shared gameplay code.
if (UCrimsonCameraComponent* Cam = UCrimsonCameraComponent::FindCameraComponent(MyPawn)){Cam->PlayCameraShake(UMyHitShake::StaticClass(), 1.0f);}
Verify
Shoulder input slides the camera to the side; zoom dollies in/out; moving makes the view trail and re-center; the local player's camera shakes (remote pawns' shakes are ignored).