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: crouched half height 60, use controller desired rotation, rotation rate yaw -1, can walk off ledges when crouching, nav agent can crouch). Speeds, acceleration, ground friction and braking are set every frame by the pawn's pre-movement update from its GASPALS > Movement settings, so copy those variables and the Calculate* functions too.
Parent class Pawn, with a CharacterMoverComponent named CharacterMover: copy its Movement Modes, Transitions (BP_MovementTransition_SuggestedMode, which the ragdoll needs, and BP_MovementTransition_Cover), Shared Settings (legacy movement and stance settings) and Sync Inputs For Sim Proxy. Copy the pawn's Movement Mode Map too (it maps the Mover mode names to the animation's movement modes, Cover to OnGround). Add a NavMoverComponent for AI. Turn off Replicate Movement on the pawn (Mover replicates itself), and implement MoverInputProducerInterface (see Cover).
Capsule: half height 86 (radius 30 on the Mover sample, 40 on the CMC sample). The capsule must ignore the Visibility, Camera and Cover channels, so camera, aim and cover traces pass through characters: use the CharacterCapsule collision profile, as both samples do. It blocks other pawns, so characters don't walk through each other and a target stays in front of you for a takedown.
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. Its name must match Third Person Mesh Name on AC_FirstPersonSystem. |
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) | Attached directly to the third-person mesh (no socket), component tag VisualOverride, Set Owner on, no child actor class (the visual override manager sets it). |
GameplayCamera (Gameplay Camera, child of the mesh, socket root) | Camera asset CameraAsset_SandboxCharacter, Auto Activate off, absolute rotation. The pawn's only camera: the sample pawns have no spring arm or Camera component. |
MotionWarping | For traversal. |
AC_CameraSystem, AC_EquipmentSystem, AC_OverlaySystem, AC_FirstPersonSystem, AC_TraversalTracer, AC_VisualOverrideManager | The systems. AC_FirstPersonSystem is the only first-person component: it also builds the first-person meshes of the retargeted characters and the held items. |
AC_TraversalLogic_CMC or AC_TraversalLogic_Mover | Name it AC_TraversalLogic. Pick the one that matches your movement: each holds its side's montage chooser, montage playback and movement mode call. The plain AC_TraversalLogic picks no montage. |
AC_CoverSystem_CMC or AC_CoverSystem_Mover | Name it AC_CoverSystem. |
AC_RagdollSystem_CMC or AC_RagdollSystem_Mover | Optional: the ragdoll. Pick the one that matches your movement and name it AC_RagdollSystem. |
AC_InteractionSystem_CMC or AC_InteractionSystem_Mover | Optional: takedowns and shoves. Pick the one that matches your movement (name it AC_InteractionSystem). |
AC_PreCMCTick | Character only. Keep its Tick Group at Pre Physics (the class default). Otherwise the Character Movement, mesh and Physics Control chain ticks during physics, and Physics Control reads empty poses (legs flying, ragdolls launched). |
AC_SmartObjectAnimation_CMC or AC_SmartObjectAnimation_Mover | Optional: benches. Name it AC_SmartObjectAnimation. Pick the one that matches your movement: it plays the bench montage the way that movement needs. The plain AC_SmartObjectAnimation plays no montage; it prints a warning and ends the interaction. |
AC_FoleyEvents | Optional: foley sounds. Play them through a small pawn function that finds the component by class (the samples' Foley_PlayEvent), so the pawn compiles and plays nothing without the component. |
PhysicsControl (both), AC_PostABPTick (Mover) | For physical animation and ragdoll settling; AC_PostABPTick applies the curve strengths right after the Mover's Anim Blueprint (the CMC ragdoll component already ticks after the mesh). The ragdoll component finds the PhysicsControl component and keeps its Physics Control Asset loaded; without it the ragdoll component shows a setup warning and the ragdoll is a plain ragdoll (setup warnings). |
AC_DebugTools | Optional: demo shot, spawn / rotate, teleport, fly. Shot, rotate and teleport need a ragdoll system and TeleportCharacter (see below); fly needs the pawn's mode functions (Get_MovementModeName, Set_MovementModeByName) or a CharacterMovementComponent (Debug tools). It handles its own inputs: see Adding the debug tools to another pawn. |
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). |
AC_FirstPersonSystem | Third Person Mesh Name = your body mesh component's name (SkeletalMesh on the Mover sample, CharacterMesh0 on the CMC sample); Default Setup = your mannequin's PDA_FirstPersonSetup (the class default, DA_FirstPersonSetup_UEFN, is the one for the UEFN mannequin). |
AC_EquipmentSystem, AC_OverlaySystem, AC_VisualOverrideManager, AC_CameraSystem, AC_TraversalLogic | Component Replicates on. (The ragdoll and interaction components replicate by default.) |
3. Interfaces¶
Add the interfaces in Class Settings > Implemented Interfaces: BPI_SandboxCharacter_Pawn and BPI_ModularSystems on both pawn types, plus MoverInputProducerInterface on a Mover pawn (see Cover).
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 |
Get_AimRay | the crosshair aim ray (from AC_CameraSystem) | Cover (cover target, aim from cover). Unimplemented, it returns zeros and cover finds no target. |
TeleportCharacter | whether it did something | Debug tools teleport and rotate (see below) |
Set_CharacterInputState | (sets the input state) | AI StateTree tasks |
Set_MovementModeByName, Get_MovementModeName | handled, mode name | Tackle montages (BP_NotifyState_OverrideMovementMode) and the debug tools' fly toggle. Without them the pawn keeps its mode through the montage. |
Set_GravityOverride | handled | Zero-gravity zones (BP_ZeroGZone). Without it the zone does nothing to the pawn. |
Get_PropertiesForRagdoll, Get_MMIResult, Get_MMIAnimContexts | ragdoll and interaction data | Character Anim Blueprints (ragdoll, takedown and shove hand IK) |
AddTarget, RemoveTarget | Target dummy (optional) |
Copy the implementations from the sample pawn of the same movement type: they read your movement component and the system components. The three movement functions are how shared assets change a pawn's movement mode and gravity without naming a Mover class: a Mover pawn queues the Mover mode by name and a Character pawn sets the Character Movement mode, so implement them for your movement instead of calling the movement component from your own assets.
BPI_ModularSystems¶
Implement the event InitializeModularSystems with the initialization chain, in this order:
UpdateFirstPersonVisuals: tell yourAC_FirstPersonSystemwhich body is shown, withSetActiveBody(the visual override's child actor, else self; SkeletalMesh_FP). Copy the function andGetVisualMeshes(withGetVisualThirdPersonMeshandGetVisualFirstPersonMesh) from the sample.Overlay_Initialize(third-person mesh)>AC_OverlaySystem.InitializeSystem.Equipment_Initialize(self, third-person mesh, SkeletalMesh_FP, visual TP mesh, visual FP mesh)>AC_EquipmentSystem.InitializeSystem, with the visual meshes fromGetVisualMeshes.AC_CameraSystem.InitializeSystem(self, visual TP mesh, visual FP mesh, GameplayCamera).- Character only:
Ragdoll_Initialize(self, mesh, capsule)>AC_RagdollSystem.InitializeSystem, thenInteraction_Initialize(self, mesh, capsule)>AC_InteractionSystem.InitializeSystem. (The Mover sample calls these two in BeginPlay instead, see Startup.) FirstPerson_InitializePrimitives>AC_FirstPersonSystem.InitializePrimitives.AC_CoverSystem.InitializeSystem(self), then bindAC_CoverSystem.OnCoverVaultReadyto your traversal call (see Traversal). Character: also bindAC_CoverSystem.OnRemoteCoverStateApplied(a Create Event node on an event of yours) to your movement settings update (UpdateMovement_PreCMCon the sample). It fires on the server when a client's cover state arrives, so the server switches speed and braking on the same move as the client.
The _Initialize functions (category GASPALS > Integration) find the component by class and skip it when your pawn doesn't have it. Copy them from the sample rather than calling the component variables, so you can leave those components out (Turning systems on and off).
The event runs again when the visible character changes: keep it safe to call more than once.
Ragdoll and teleport (optional)¶
So the debug tools and the TriggerRagdoll anim notify work on your pawn:
- Teleport: implement
TeleportCharacterfromBPI_SandboxCharacter_Pawn(copy it from the sample pawn of the same movement type). It returns whether it did something. - Ragdoll: the ragdoll component (
AC_RagdollSystem_CMCorAC_RagdollSystem_Mover) implementsBPI_RagdollSystem. A Mover pawn also needs theRagdollmovement mode and theBP_MovementTransition_SuggestedModetransition on itsCharacterMoverComponent(register the mode asRagdoll, or set Ragdoll Mode Name on the component), and the pawn hooks ofSandboxCharacter_Mover, copied with their calls:Ragdoll_Initializein BeginPlay;Ragdoll_WriteInputs(InCmd, MoveInput)inProduceInput;Ragdoll_OnModeChangedfromOn_MovementModeChanged_PostFinalize;Ragdoll_RequestGetUpfrom the jump input; andGet_PropertiesForRagdoll,Get_MMIResultandGet_MMIAnimContexts, which forward to the components. If you implementBPI_RagdollSystemyourself instead, implementRequestGetUpto support the get-up keys; unimplemented, it returns false and the character cannot get up with X or Space. - Get-up keys: X is handled by the ragdoll component (ragdolling:
RequestGetUp, else start the ragdoll). For Space, callRequestGetUpfrom your jump input while ragdolling: copy the Character sample'sRagdoll_RequestGetUpwrapper (it finds the component by class, so the pawn still compiles without it), or on a Mover pawn callRequestGetUpfrom the jump input in theRagdollmode. - Physics Control (both pawns): without a
PhysicsControlcomponent the ragdoll component prints a setup warning and the ragdoll has no physical animation, settling or roll. ThePhysicsControlcomponent holds its Physics Control Asset through a soft reference only, so in a packaged game the asset can be garbage-collected and the physics profiles stop applying. The ragdoll component keeps the loaded asset inLoadedPhysicsControlAssetfrom its initialization; keep a hard reference the same way if you use the Physics Control component elsewhere.
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). Mover: also Ragdoll_Initialize, then Interaction_Initialize (self, mesh, capsule). |
| Possessed (server) | Call a reliable Client RPC on the owner that runs SetupCamera and SetupInput, then BPFL_GASPALS.CheckConsoleVariables (pass self, and in Pawn Console Variables a comma-separated list of the DDCvar.* variables only your pawn reads; the Mover sample passes its four, the CMC sample none; it shows an on-screen warning listing the DDCvar.* variables the project does not declare). Character: also AC_PreCMCTick.AddTickPrerequisiteActor(Controller). |
SetupCamera | GameplayCamera.ActivateCameraForPlayerController(PC, true): activate the Gameplay Camera for the player and make it the view target. Copy the sample pawn's function. |
SetupInput | For each entry of an Input Mapping Contexts map (context > priority, default IMC_Sandbox at 0): Enhanced Input Local Player Subsystem > Add Mapping Context. Copy the sample pawn's function, including the Warn if No Input Mapping Contexts switch (bWarnIfNoInputMappingContexts, default on) that shows the empty-map warning: turn it off in a game that adds its own contexts. |
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 reliable Server RPC that sets a replicated S_PlayerInputState (the CMC sample replicates it skipping the owner). Copy the GASPALS > Input variables too: Input Mapping Contexts and the Hold Toggle settings (Toggle Crouch, Toggle Walk, Toggle Sprint, Toggle Aim, Toggle Strafe), which the sample handlers read through BPFL_GASPALS.GetHoldToggleInput.
N (next pawn), M (next character) and J (teleport) are not handled by the pawn: PC_Sandbox handles them, and the pawn and character switches go through GM_Sandbox. Keep PC_Sandbox and GM_Sandbox (or children of them) to use these keys with your pawn.
Analog walk / run and slide (Character)¶
To get the sample's analog walk / run (DDCvar.AnalogInputStyle) and the slide on your Character, copy from SandboxCharacter_CMC:
- Analog walk / run:
GetLocalFullMovementInput,SyncFullMovementInput(first node of your movement settings update), theServerSetFullMovementInputevent andbFullMovementInputRep/bLastSentFullMovementInput; your gait readsbLastSentFullMovementInputon the owner andbFullMovementInputRepelsewhere (GetDesiredGait). - Slide: the GASPALS > Movement > Slide variables,
UpdateSlideState(in the pre-movement event, before the movement settings),ApplySlideMovementSettings(last in the movement settings),UpdateSlideAudio(after them),SyncSlideState,IsSlideActive,IsSlideBoostActive,GetSlideSlopeAngleand theServerSetSlideStateevent.UpdateSlideAudioplays the slide sound throughAC_FoleyEvents: leave it out if your pawn has no foley component. ReportSlidingas the movement mode inGet_PropertiesForAnimationwhileIsSlideActive; the CMC Anim Blueprint then searches its Slide Databases.
6. 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).
Multiplayer: the server only knows the client's last move, so choose movement settings from values both sides have. The sample picks its braking deceleration from the Character Movement's current acceleration (not from the pending input), and applies the cover state when it arrives (OnRemoteCoverStateApplied, see Startup). Without that, every stop and every cover run gets a small server correction.
In ProduceInput:
RemapCoverMoveInput(move input)before setting the directional input.EvaluateCover(move input, delta seconds)after it; add itsS_CoverStateoutput to the input collection.- Crouch request = (wants to crouch or the cover's force crouch) and not
IsCoverCrouchBlocked. - Gait: walk in cover unless crouched, sprint during a cover run. Rotation offset 0 in cover.
- Orientation intent from
GetCoverOrientationIntent.
Register BP_MovementMode_Cover as Cover, add BP_MovementTransition_Cover to the global transitions, and map Cover to OnGround in your Movement Mode Map (step 1). AC_CoverSystem_Mover ticks UpdateMoverCoverState, UpdateCoverVault and the cover marker itself.
Both: IA_CoverSticky Started calls RequestStickyCover; Completed and Canceled call ReleaseStickyCover. IA_CoverRun Started calls RequestCoverRun; Completed and Canceled call ReleaseCoverRun.
7. Traversal¶
Implement GetTraversalCheckInputs (copy from the sample) and on jump:
- If a traversal is possible (not already traversing; Mover: no montage playing), call
AC_CoverSystem.RequestCoverVault. - If it is not deferred, call
AC_TraversalLogic.TryTraversalAction(GetTraversalCheckInputs, ...). - If the traversal check or montage selection failed, jump.
OnCoverVaultReady (bound during initialization) calls TryTraversalAction when the character has turned to the wall.
8. 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 (Networking).
While you play, watch for orange on-screen messages (missing console variables, an empty Input Mapping Contexts map, GASPALS First Person (...) setup warnings, the ragdoll component's setup warnings) and for "Accessed None" errors in the Output Log: each one points at a connection from the steps above. See Troubleshooting.