Skip to content

Add the systems to your own pawn

The simplest path is a child Blueprint of a sample pawn (Use GASPALS in your own project). This page is for when you need your own pawn class, for example to add GASPALS to an existing character. It lists every connection the sample pawns make. Open SandboxCharacter_CMC or SandboxCharacter_Mover next to your pawn and copy the graphs as you go.

Background: Architecture.

1. Base class and movement

Parent class Character. Copy the sample's Character Movement settings (CharMoveComp: max acceleration 500, braking deceleration 500, braking friction factor 0, crouched half height 60, use controller desired rotation, rotation rate yaw -1).

Parent class Pawn, with a CharacterMoverComponent named CharacterMover: copy its Movement Modes, Transitions (BP_MovementTransition_Cover), Shared Settings (legacy movement and stance settings) and Sync Inputs For Sim Proxy. Add a NavMoverComponent for AI. Turn off Replicate Movement on the pawn (Mover replicates itself), and implement MoverInputProducerInterface (see Cover).

Capsule: half height 86. The Mover sample uses the CharacterCapsule collision profile (ignores Visibility and Camera) so camera and visibility traces pass through characters.

2. Components

Component Notes
Third-person Skeletal Mesh SKM_UEFN_Mannequin with SandboxCharacter_Mover_ABP or SandboxCharacter_CMC_ABP, location (0, 0, -88), yaw -90, component tag ThirdPersonRendering.
SkeletalMesh_FP (Skeletal Mesh, child of the mesh) SKM_UEFN_Mannequin_FP_Arms with ABP_FirstPerson_UEFN; Only Owner See, Owner No See, no shadow, First Person Primitive Type FirstPerson. The first-person logic mesh.
VisualOverride (Child Actor, child of the mesh) Component tag VisualOverride, Set Owner on.
GameplayCamera (Gameplay Camera, child of the mesh, socket root) Camera asset CameraAsset_SandboxCharacter, Auto Activate off, absolute rotation.
MotionWarping For traversal.
AC_CameraSystem, AC_EquipmentSystem, AC_OverlaySystem, AC_FirstPersonRendering, AC_TraversalLogic, AC_TraversalTracer, AC_VisualOverrideManager The systems.
AC_CoverSystem_CMC or AC_CoverSystem_Mover Name it AC_CoverSystem.
AC_RagdollSystem, AC_PreCMCTick Character only.
AC_SmartObjectAnimation, AC_FoleyEvents Optional: benches, foley sounds.

Component settings

Set these on your pawn's components (class defaults do not reach existing component templates):

Component Setting
AC_CoverSystem Enable Cover on (the class default, so a new component already has it; the sample pawns also set it).
AC_TraversalLogic Is Mover Character on for Mover pawns.
AC_FirstPersonRendering Third Person Mesh Name = your mesh component's name; the three first-person mesh lists (copy from the sample).
AC_EquipmentSystem, AC_OverlaySystem, AC_VisualOverrideManager, AC_CameraSystem, AC_TraversalLogic Component Replicates on.

3. Interfaces

Add both interfaces in Class Settings > Implemented Interfaces.

BPI_SandboxCharacter_Pawn

Function Return Required by
Get_PropertiesForAnimation S_CharacterPropertiesForAnimation Character, overlay and first-person Anim Blueprints, cover
Get_PropertiesForCamera S_CharacterPropertiesForCamera Camera director
Get_PropertiesForTraversal S_CharacterPropertiesForTraversal Traversal
Set_CharacterInputState (sets the input state) AI StateTree tasks
Get_PropertiesForRagdoll, Get_MMIResult, Get_MMIAnimContexts ragdoll and interaction data Mover Anim Blueprint (ragdoll pawn features)
AddTarget, RemoveTarget Target dummy (optional)

Copy the implementations from the sample pawn: they read your movement component and the system components.

BPI_ModularSystems

Implement the event InitializeModularSystems with the initialization chain, in this order:

  1. UpdateFirstPersonVisuals: pick the active AC_FirstPersonRendering (the visual override's, else yours), call ConnectLogicMesh(SkeletalMesh_FP) and BuildFirstPersonMeshes. Copy the function and GetVisualMeshes from the sample.
  2. AC_OverlaySystem.InitializeSystem(third-person mesh).
  3. AC_EquipmentSystem.InitializeSystem(self, third-person mesh, SkeletalMesh_FP, visual TP mesh, visual FP mesh) with the visual meshes from GetVisualMeshes.
  4. AC_CameraSystem.InitializeSystem(self, visual TP mesh, visual FP mesh, GameplayCamera).
  5. Character only: AC_RagdollSystem.InitializeSystem(self, mesh, capsule).
  6. AC_FirstPersonRendering.InitializePrimitives.
  7. AC_CoverSystem.InitializeSystem(self), then bind AC_CoverSystem.OnCoverVaultReady to your traversal call (see Traversal).

The event runs again when the visible character changes: keep it safe to call more than once.

4. Startup

When Do
BeginPlay Mover: the mesh ticks after CharacterMover and after the actor. Character: CharacterMovement ticks after AC_PreCMCTick, and bind AC_PreCMCTick's Tick to your pre-movement event. Then call InitializeModularSystems (on self).
Possessed (server) Call a Client RPC on the owner that runs SetupCamera and SetupInput. Character: also AC_PreCMCTick.AddTickPrerequisiteActor(Controller).
SetupCamera If DDCVar.NewGameplayCameraSystem.Enable: GameplayCamera.ActivateCameraForPlayerController(PC, true).
SetupInput Enhanced Input Local Player Subsystem > Add Mapping Context(IMC_Sandbox, 0).

5. Input

Handle in the pawn: move, look, sprint, walk, strafe, aim, crouch, jump, cover. The other actions are handled by the components and the controller (see Add or rebind inputs). Replicate the input state with a Server RPC that sets a replicated S_PlayerInputState (the CMC sample replicates it skipping the owner).

Cover

In the pre-movement event (from AC_PreCMCTick), first call AC_CoverSystem.UpdateCoverCMC(DeltaSeconds), then your rotation and speed updates. In cover, use the walk gait (sprint during a cover run).

In ProduceInput:

  1. RemapCoverMoveInput(move input) before setting the directional input.
  2. EvaluateCover(move input, delta seconds) after it; add its S_MoverCustomInputs_Cover output to the input collection.
  3. Crouch request = (wants to crouch or the cover's force crouch) and not IsCoverCrouchBlocked.
  4. Gait: walk in cover unless crouched, sprint during a cover run. Rotation offset 0 in cover.
  5. Orientation intent from GetCoverOrientationIntent.

Register BP_MovementMode_Cover as Cover, add BP_MovementTransition_Cover to the global transitions, map Cover to on-ground in your movement mode map, and tick UpdateMoverCoverState and UpdateCoverVault.

Both: IA_Cover Started calls RequestStickyCover; Completed and Canceled call ReleaseStickyCover.

Traversal

Implement GetTraversalCheckInputs (copy from the sample) and on jump:

  1. If a traversal is possible (not already traversing; Mover: no montage playing), call AC_CoverSystem.RequestCoverVault.
  2. If it is not deferred, call AC_TraversalLogic.TryTraversalAction(GetTraversalCheckInputs, ...).
  3. If the traversal check or montage selection failed, jump.

OnCoverVaultReady (bound during initialization) calls TryTraversalAction when the character has turned to the wall.

6. Test

Run through the Quick start on your pawn: locomotion, traversal, cover (soft, sticky, run, corner, aim, vault), equipment in third and first person, overlays, perspectives, characters (M), and a listen server with a client.