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, one subfolder per perspective) |
| Data | Data/ (enums E_CameraPerspective, E_CameraStyle, E_CameraMode, E_CameraSide, E_FixedCameraMouseAimType; struct S_CameraOffsetRigs) |
| Widget | W_Crosshair |
| Camera shake | CameraShake_Basic (played by the takedown montages' camera shake notify) |
| Input | IA_Camera_Perspective 1 / gamepad View, IA_Camera_Style 2, IA_Camera_SwitchShoulder 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 Third Person Camera Bone (root) |
| TopDown | Fixed-angle camera above the character; the character aims at the mouse cursor or with the right stick. | The visible mesh's Third Person Camera Bone (root) |
| SideScroller | Fixed side view; aims like top-down. | The visible mesh's Third Person Camera Bone (root) |
| FirstPerson | Eye camera on the first-person mesh. See First person. | The first-person lead mesh's camera bone (Camera Bone in each body's first-person setup, default the VB Camera virtual bone) |
1 cycles through Allowed Perspectives in their order. By default: third person, top-down, side-scroller, first person, back to third person. Each switch prints the new perspective on screen. The visible mesh is the retargeted character's when one is active, so the camera follows it.
Choosing the perspectives¶
Allowed Perspectives lists the views players can use. Set it on the AC_CameraSystem component of each pawn you use. Common setups:
| Game | Allowed Perspectives | Result |
|---|---|---|
| First person only | FirstPerson | Starts in first person; 1 does nothing. |
| Third person only | ThirdPerson | No first-person meshes are built; 1 does nothing. You can also delete AC_FirstPersonSystem from the pawn. |
| Third and first person | ThirdPerson, FirstPerson | 1 toggles between them. |
If Camera Perspective (the start view) is not in the list, the camera starts in the first allowed one and shows an on-screen warning. FirstPerson only counts as available when the pawn has an enabled AC_FirstPersonSystem; when it is listed without one, a warning says so and first person is skipped. With only first person allowed, cover's First Person Sticky Cover setting SwitchToThirdPerson acts like Disabled (Cover).
The ragdoll view (Camera Perspective During Ragdoll, default ThirdPerson) is only used when it is allowed; otherwise the ragdoll keeps the current view. With a first-person-only list that happens silently while the ragdoll view is still at its ThirdPerson default, so restricting the list needs no other change. If you picked another ragdoll view that is not in the list, a warning says so.
Styles¶
The style picks a variant per perspective. 2 cycles it (Style_2, Style_3, Style_4, Style_1, then back) and prints the new style on screen; the console variable DDCvar.CameraStyle (0 to 3) sets it too.
| Style | Third person | Top-down / side-scroller | First person |
|---|---|---|---|
| Style_1 | Close | CameraRig_TD_1 / CameraRig_SS_1 | Same rig in every style |
| Style_2 (default) | Medium | _2 | |
| Style_3 | Far | _3 | |
| Style_4 | Debug view (CameraRig_DebugView, no offset rigs) | _4 |
How the rig is chosen¶
Every frame the director:
- Reads the pawn's
Get_PropertiesForCamera: perspective, style, mode (Free, Strafe or Aim, from the pawn's rotation mode and aim input; a target lock gives Strafe or Aim), shoulder side, stance and movement mode. - Evaluates the chooser table
CHT_CameraRig, which branches by perspective intoCHT_CameraRigs_ThirdPerson,_FirstPerson,_TopDownor_SideScroller. Third person picks by style and mode: nine rigsCameraRig_TP_<Close|Medium|Far>_<Freecam|Strafe|Aim>; the Aim rigs blend in smoothly. The third-person fallback isCameraRig_TP_Medium_Freecam. First person always usesCameraRig_FP_Base. - Activates the result, plus the First Person Scale Rig in first person when the pawn's first-person system uses the
FirstPersonOverlaySplitmode. - In third person (except the debug style Style_4), stacks the offset rigs from Camera Offset Rigs on
AC_CameraSystem:
| Entry | Default rig | When | Offset |
|---|---|---|---|
| Crouch Rig | CameraRig_TP_Offset_Crouch | Crouched | 50 cm down |
| Right Shoulder Rig | CameraRig_TP_Offset_Right | Camera on the right shoulder (the player's choice, or the cover shoulder switch at a wall end) | 100 cm to the side |
| Cover Low Rig | CameraRig_TP_Offset_CoverLow | Behind low cover | 80 cm up |
| Cover Edge Right Rig / Cover Edge Left Rig | CameraRig_TP_Offset_CoverEdgeRight / Left | At a cover wall end | 60 cm to the open side |
| First Person Scale Rig | CameraRig_FP_Scale | First person, FirstPersonOverlaySplit mode | First-person scale 0.25 (keeps arms and weapon out of walls) |
| In Air Rig | CameraRig_TP_Offset_InAir | Jumping or falling | 30 cm back, 20 cm up |
| Sliding Rig | CameraRig_TP_Offset_Sliding | Sliding (Mover pawn only) | 30 cm down |
| Traversing Rig | CameraRig_TP_Offset_Traversing | Vaulting or climbing | 40 cm back |
| Ragdoll Rig | CameraRig_TP_Offset_Ragdoll | Ragdolling in third person | 40 cm up, tilted 38° down, so the body on the floor stays in view |
The offsets apply after the base rig's collision push, so a translation offset is not checked against walls or the floor. A backward offset points down when the player looks up and can move the camera under the floor; prefer upward offsets and rotations when you make your own rigs.
The four movement-mode rigs (in air, sliding, traversing, ragdoll) need Pass Movement Mode to Camera on. The cover rigs follow the cover system's Enable Cover Camera Offsets and Enable Cover Shoulder Switch settings (Cover).
Each pawn sets its own rigs on its camera component, so two characters can use different offsets. Point an entry at your own rig to change an offset, or clear it to turn that offset off. The director's own Camera Offset Rigs is only used for a pawn without AC_CameraSystem.
The chooser table itself is fixed in the director (the engine's Evaluate Chooser node takes the table as a node setting, not an input). To change which main rig is used when, edit CHT_CameraRig and its nested tables, or duplicate them and the director.
First person needs no crouch offset: the first-person camera follows the head, so it lowers with the head when the character crouches (about 26 cm 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 Camera Rig Asset 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 the Crosshair Widget Class (default W_Crosshair) and keeps it centered on the aim point:
- Third and first person: a line trace (Aim Trace Channel, default Visibility; Aim Trace Distance, default 100 m) from the camera along its forward vector; the dot sits where it hits, or at the end of the ray.
- Top-down and side-scroller: the same trace from the mouse cursor into the world, so the dot sits on the point under the cursor; with a gamepad, a point 3 m out along the right stick direction.
In the fixed cameras the character also turns toward the aim. Fixed Camera Mouse Aim Type picks how the mouse gives that direction: MouseTraceWithPositionFallback (default) faces the world point under the cursor, or uses the cursor's screen position when nothing is under it; MouseScreenPosition always uses the cursor's position relative to the screen center.
GetCrosshairAim returns the aim origin, direction, point, whether it hit, and a flattened direction. The pawns pass it on through the pawn interface function Get_AimRay (with the trace channel and distance), which is what cover targeting and aim from cover read; aim from cover traces with the same channel and length, so the crosshair and the cover line of fire never disagree.
The camera component only creates and places the crosshair, at the point the aim ray hits. The widget decides how it looks: W_Crosshair is a dot in its Default Color (white). Cover targets are shown by the cover marker, not the crosshair; a custom crosshair can still ask the cover system (IsCoverTargeted).
Turn Show Crosshair off to hide the dot (it is collapsed, not destroyed). The aim ray, cover targeting and the cover marker keep working.
Ragdoll camera¶
With Change Perspective During Ragdoll on (default), the camera switches to Camera Perspective During Ragdoll (default ThirdPerson) while the character ragdolls, and back to the previous view afterwards. With the defaults, a player in first person, top-down or side-scroller sees the ragdoll in third person; a player already in third person keeps the view, and the Ragdoll Rig offset raises the camera and tilts it down onto the body. Both pawns trigger it through their ragdoll component (AC_RagdollSystem), which tells the camera system through BPI_RagdollSystemListener.
The switch only happens when the ragdoll view is in Allowed Perspectives (see Choosing the perspectives). Only the player's own copy switches; the other machines get the perspective through replication.
Allow Camera Switch (default off) decides whether the perspective and shoulder inputs work during the ragdoll; looking around is never blocked. If the player changes the perspective during the ragdoll, that view is kept afterwards. Both ragdoll settings only apply while Change Perspective During Ragdoll is on.
Settings¶
On AC_CameraSystem (Details panel, Camera category). Both sample pawns use these defaults.
| Setting | Category | Default | Use |
|---|---|---|---|
| Enable Camera System | General | true | Off: a fixed third-person view with the default style and shoulder; the perspective, style and shoulder inputs do nothing, there is no crosshair, and the ragdoll keeps the view. Read when play starts. |
| Third Person Camera Bone | General | root | Bone or socket of the visible mesh the camera attaches to in every perspective but first person. |
| Camera Style | General | Style_2 (medium) | Start style. |
| Is Camera Right Shoulder | General | false | Start shoulder. |
| Camera Perspective | Perspective | ThirdPerson | Start perspective. Must be in Allowed Perspectives. |
| Allowed Perspectives | Perspective | ThirdPerson, TopDown, SideScroller, FirstPerson | Views the player can use; 1 cycles them in this order. |
| Show Crosshair | Crosshair | true | Show the crosshair dot for the local player. |
| Crosshair Widget Class | Crosshair | W_Crosshair | Any User Widget; it is added to the viewport and centered on the aim point. |
| Aim Trace Channel | Crosshair | Visibility | Channel of the aim ray (crosshair, cover targeting, aim from cover). |
| Aim Trace Distance | Crosshair | 10000 | Length of the aim ray in cm. |
| Camera Offset Rigs | Rigs | the ten rigs above | Offset rigs the director stacks on the main rig. Clear an entry to turn that offset off. |
| Pass Movement Mode to Camera | Rigs | true | The pawn tells the camera whether it is on the ground, in the air, sliding, traversing or ragdolling, for the movement-mode rigs (and for your own chooser rows). Off = always on the ground. The CMC pawn has no slide. |
| Change Perspective During Ragdoll | Ragdoll | true | See Ragdoll camera. |
| Camera Perspective During Ragdoll | Ragdoll | ThirdPerson | See Ragdoll camera. |
| Allow Camera Switch | Ragdoll | false | See Ragdoll camera. |
| Fixed Camera Mouse Aim Type | FixedCamera | MouseTraceWithPositionFallback | Fixed cameras: how the mouse turns the character (see Crosshair and aim). |
Set new values on each pawn
Change these settings on the AC_CameraSystem component of each pawn Blueprint (select the component in the Components panel). A changed class default does not reach a pawn whose component already overrides that value.
The Gameplay Camera is the pawns' only camera: they have no spring arm or Camera component, and the pawn activates the GameplayCamera component for the player when it is possessed.
Using the camera from Blueprints¶
| Call | Use |
|---|---|
SetCameraPerspective | Change the perspective to the one passed in (re-attaches the camera, tells the server, fires OnCameraPerspectiveChanged). It does not check Allowed Perspectives: call IsPerspectiveAvailable first. |
OnCameraPerspectiveChanged | Event dispatcher with the new perspective. |
RegisterCameraListener(Listener) (BPI_CameraSystem) | Adds a component implementing BPI_CameraSystemListener; after every perspective change the camera calls its OnCameraViewChanged(bFirstPerson). AC_FirstPersonSystem registers itself this way. |
RequestFirstPersonView(bFirstPerson) (BPI_CameraSystem) | Switch to first person (true) or third person (false); returns false when the camera system is disabled. |
IsFirstPersonView, IsFixedCameraView, IsCameraRightShoulder (BPI_CameraSystem) | Current view and shoulder, for other systems. |
IsPerspectiveAvailable(Perspective) | True when the perspective is allowed (and, for first person, the pawn has an enabled AC_FirstPersonSystem). With Enable Camera System off, only ThirdPerson. |
GetNextAvailablePerspective, GetFirstAvailablePerspective | What 1 would switch to; the fallback start view. |
GetCrosshairAim | The aim ray and point. Only valid for player-controlled pawns. |
Get_AimRay (pawn interface) | The same ray plus the trace channel and distance; zeros when the pawn has no camera system or no player controller. |
CameraPerspective, CameraStyle, bIsCameraRightShoulder | Current state. |
Other systems reach the camera through BPI_CameraSystem (find the pawn's component that implements it), so they keep working when a pawn has no camera system.
Networking¶
The perspective is set on the owning client and sent to the server (Server_SetCameraPerspective); it replicates to the other machines. Style, shoulder and crosshair are local to the player. The component needs Component Replicates on; both sample pawns set it on their AC_CameraSystem.
Limitations¶
- A new style or mode needs matching chooser rows and rigs.
- The offset rigs (crouch, shoulder, cover, movement modes) apply in third person only.
- The main rig chooser table can't be swapped per pawn (see How the rig is chosen).
- Rig graph edits need the Camera Rig Asset editor; save each rig asset after editing.
Related¶
- Customize the camera
- First person system
- Cover system for the cover camera offsets and aim from cover
- Ragdoll and interactions
- Camera reference