Skip to content

Camera system

The camera is built on Unreal's Gameplay Cameras. A Blueprint camera director picks camera rigs every frame from the character's state, and the component AC_CameraSystem handles the perspective, attaches the camera to the right mesh, and draws the crosshair.

Folder /GASPALS/Systems/CameraSystem
Component AC_CameraSystem (on both pawns)
Camera asset CameraAsset_SandboxCharacter (the pawns' Gameplay Camera component uses it)
Director CameraDirector_SandboxCharacter (Blueprint camera director)
Rigs Rigs/ (chooser tables CHT_CameraRig* and camera rigs)
Widget W_Crosshair
Camera shake CameraShake_Basic (played by the takedown montages' camera shake notify)
Input Perspective 1, style 2, shoulder Alt / ++r3++
Settings Camera reference

Perspectives

Perspective Camera Attached to
ThirdPerson (default) Over-the-shoulder camera with collision push and damping. The visible mesh's root
TopDown Fixed-angle camera above the character; the character aims at the mouse cursor or with the right stick. The visible mesh's root
SideScroller Fixed side view; aims like top-down. The visible mesh's root
FirstPerson Eye camera on the first-person mesh. See First person. The first-person lead mesh's VB Camera virtual bone

1 cycles: third person, top-down, side-scroller, first person, back to third person. The visible mesh is the retargeted character's when one is active, so the camera follows it.

Styles

The style picks a variant per perspective. 2 cycles it; DDCvar.CameraStyle sets it too.

Style Third person Top-down / side-scroller
Style_1 Close CameraRig_TD_1 / CameraRig_SS_1
Style_2 (default) Medium _2
Style_3 Far _3
Style_4 Debug view (CameraRig_DebugView) _4

How the rig is chosen

Every frame the director:

  1. Reads the pawn's Get_PropertiesForCamera: perspective, style, mode (Free, Strafe or Aim, from the pawn's rotation mode and aim input), shoulder side and stance.
  2. Evaluates the chooser table CHT_CameraRig, which branches by perspective into CHT_CameraRigs_ThirdPerson, _FirstPerson, _TopDown or _SideScroller. Third person picks by style and mode: nine rigs CameraRig_TP_<Close|Medium|Far>_<Freecam|Strafe|Aim>; the Aim rigs blend in smoothly. The fallback is CameraRig_TP_Medium_Freecam.
  3. Activates the result, and CameraRig_FP_Scale in first person when the character uses the Split first-person mode.
  4. In third person (except the debug style), stacks offset rigs:
Offset rig When Offset
CameraRig_TP_Offset_Crouch Crouched 50 cm down
CameraRig_TP_Offset_Right Right shoulder (or a cover edge on the right) 100 cm side
CameraRig_TP_Offset_CoverLow Behind low cover 80 cm up
CameraRig_TP_Offset_CoverEdgeLeft / Right At a cover wall end 60 cm to the open side

First person needs no crouch offset: the first-person camera follows the head bone, so it lowers with the head when the character crouches (about 26 cm, measured on the Mover pawn with the UEFN mannequin).

The persistent layers CameraRig_Layer_Global and CameraRig_Layer_Base are activated when the director starts.

The base rigs hold the shared parameters, and the variants override them:

Base rig Parameters
ThirdPerson/CameraRig_TP_Base Boom arm offset, camera offset, field of view, forward / lateral / vertical damping, collision push
TopDown/CameraRig_TopDown_Base, SideScroller/CameraRig_SideScroller_Base Camera translation and rotation, field of view, damping
FirstPerson/CameraRig_FP_Base Field of view, offset, a First Person node (keeps first-person meshes out of the third-person shadow; do not remove it)

To change the look, open the rigs in the Gameplay Cameras editor. To change which rig is used when, edit the chooser tables. See Customize the camera.

Crosshair and aim

For the locally controlled player, AC_CameraSystem creates W_Crosshair and keeps its dot on the aim point:

  • Third and first person: a line trace (Visibility, 100 m) from the camera along its forward vector; the dot sits where it hits.
  • Top-down and side-scroller: the world point under the mouse cursor (Fixed Camera Mouse Aim Type), or with a gamepad, 3 m out along the right stick direction.

GetCrosshairAim returns the aim origin, direction, point, whether it hit, and a flattened direction. Cover targeting and aim from cover use it. The dot turns green while the cover button would take the character to cover.

Ragdoll camera

With Change Perspective During Ragdoll on (default), the camera switches to Camera Perspective During Ragdoll (top-down) while the CMC pawn ragdolls (AC_RagdollSystem), and back afterwards. Allow Camera Control During Ragdoll decides whether the player can still look around. The Mover ragdoll pawn uses its own ragdoll and keeps the camera.

Settings

On AC_CameraSystem:

Setting Default Use
Camera Perspective ThirdPerson Start perspective.
Camera Style Medium (Style_2) Start style.
Is Camera Right Shoulder false Start shoulder.
Enable First Person Rendering true Lets AC_FirstPersonRendering follow perspective changes. Off: first-person meshes are never set up.
Change Perspective During Ragdoll true See above.
Camera Perspective During Ragdoll TopDown See above.
Allow Camera Control During Ragdoll false See above.
Fixed Camera Mouse Aim Type MouseTraceWithPositionFallback Fixed cameras: aim at the world point under the cursor, or use the cursor's screen position.

DDCVar.NewGameplayCameraSystem.Enable (project setting, default on) must stay on. Off, the pawns fall back to a plain spring arm camera and none of this runs.

Using the camera from Blueprints

Call Use
SetCameraPerspective(NewPerspective) Change the perspective (re-attaches the camera, tells the server, fires OnCameraPerspectiveChanged).
OnCameraPerspectiveChanged Event dispatcher with the new perspective. First-person rendering listens to it.
GetCrosshairAim The aim ray and point. Only valid for player-controlled pawns.
CameraPerspective, CameraStyle, bIsCameraRightShoulder Current state.

Networking

The perspective is set on the owning client and sent to the server (Server_SetCameraPerspective); it replicates to other machines. Style, shoulder and crosshair are local to the player.

Limitations

  • A new style or mode needs matching chooser rows and rigs.
  • The offset rigs (crouch, shoulder, cover) apply in third person only.
  • Rig graph edits need the Gameplay Cameras editor; save each rig asset after editing.