Skip to content

Debug tools

/GASPALS/Systems/DebugTools/AC_DebugTools is a component on both pawns (SandboxCharacter_Mover and SandboxCharacter_CMC) that groups the sandbox's demo and debug tools: shooting characters into ragdoll, spawning or rotating characters, teleporting and flying. It works in any game mode; RagdollLevel, with its target characters and physics obstacles, is the place to try it. Enable Debug Tools turns it off, and it can be removed from the pawn (Turning systems on and off).

Controls

Input Condition Action
Left Button (gamepad RT) aim held (Right Button or LT) Shoot: the character hit goes ragdoll, with an impulse at the bone that was hit. Without aim, the same key is a takedown.
E (gamepad Y) aim held Spawn or rotate: rotate the character you aim at by 90 degrees, or spawn a new character on the floor where you aim. Without aim, E is a shove or a bench interaction.
J Teleport to the point under the view.
Z keyboard only Fly: toggle the Mover Flying mode (CMC pawn: the Character Movement's Flying mode).

The component handles its own input: its IA_Takedown and IA_Interact events call Shoot and Spawn Or Rotate while aim is held (without aim they leave the keys to the takedown, shove and bench), and a raw Z key event toggles fly. The pawns have no input of their own for these tools. J (IA_TeleportToTarget) belongs to the player controller (PC_Sandbox), which calls the component's Teleport To Target when the possessed pawn has one. N (next pawn) and M (next character) belong to the player controller too. See Controls.

How it works

  • Aim. Every tool reads the view from the pawn's camera (its Gameplay Camera component), or from the pawn's eyes when it has no camera component.
  • Shoot. The server traces along the view for physics bodies; the character hit is asked to ragdoll and to push the bone that was hit (BPI_RagdollSystem, through Get Ragdoll System). The impulse waits up to 1 s for the body to start simulating. It hits Mover and CMC characters alike.
  • Spawn or rotate. The server traces along the view. A character hit (Mover or CMC) is turned 90 degrees; anything else spawns a new character of your pawn's class at the hit point (or at the end of the trace), facing you. Only the last Max Spawned Characters spawned characters are kept: the oldest is destroyed. Spawned characters have no player, so they get up by themselves after a ragdoll (Ragdoll).
  • Teleport. A sphere trace runs from the eyes along the view; the pawn moves just off the surface hit, or to the end of the trace, keeping its rotation. Pawns without the component use the controller's own teleport instead, with the controller's Teleport Max Distance (also 10000 cm). With Enable Debug Tools off, J does nothing on a pawn that has the component.
  • Fly. Switches the Mover pawn between the Flying mode and falling, with an on-screen message. On the CMC pawn it sets the Character Movement to Flying, or back to Falling when already flying.

Configuration

Settings on the AC_DebugTools component of each pawn:

Setting Category Default Use
Enable Debug Tools Debug Tools > General true Master switch for the shot, spawn / rotate, teleport and fly tools of this component.
Shot Trace Distance Debug Tools > Demo 100000 Length of the shot trace in cm.
Shot Impulse Debug Tools > Demo 2500 Impulse applied to the bone hit by a shot.
Spawn Trace Distance Debug Tools > Demo 1000 Reach of the spawn / rotate trace in cm; with no hit the character spawns at the end of the trace.
Max Spawned Characters Debug Tools > Demo 3 Spawned characters kept alive; the oldest is destroyed beyond this.
Teleport Max Distance Debug Tools > Teleport 10000 Reach of the teleport trace in cm.

Shipping a game

Turn Enable Debug Tools off on your pawn, or remove the component, so players can't spawn characters or teleport. The component is optional: nothing else in GASPALS depends on it. It handles its own input and the pawns don't reference it, so the pawn still compiles without it.

The full variable and function list is in the Pawns and Anim Blueprints reference.

Adding the debug tools to another pawn

What each tool needs:

Tool Your pawn needs The target needs
Shoot Aim (Get_PropertiesForAnimation from BPI_SandboxCharacter_Pawn, Wants To Aim) A ragdoll system (BPI_RagdollSystem, on one of the actor's components or on the actor itself) and a mesh that a PhysicsBody trace hits
Rotate Aim, as for Shoot TeleportCharacter from BPI_SandboxCharacter_Pawn
Spawn Aim, as for Shoot
Teleport TeleportCharacter from BPI_SandboxCharacter_Pawn; possessed by PC_Sandbox (or your controller calls Teleport To Target)
Fly The pawn's Get_MovementModeName and Set_MovementModeByName (BPI_SandboxCharacter_Pawn), else a CharacterMovementComponent
  1. Open your pawn Blueprint. In the Components panel, click Add and pick AC_DebugTools. Component Replicates is already on in its class defaults; leave it on.
  2. Make sure your input mapping context maps IA_Takedown and IA_Interact (IMC_Sandbox does): the component binds them itself, and Z for flying. To use other inputs, call Shoot, Spawn Or Rotate or Toggle Debug Fly from your own events.
  3. Compile and save. Play with your pawn in a level that has another character with a ragdoll system (a placed SandboxCharacter_Mover, for example). Hold aim on that character and shoot: it falls into ragdoll. Aim at the floor and spawn: a character of your pawn's class appears. Press J: your pawn moves to the point you look at.

Networking

Tool How it replicates
Shoot The owner sends its view to the server (reliable server RPC); the server traces and starts the ragdoll, and the impulse is multicast to every machine.
Spawn or rotate The owner sends its view to the server (reliable server RPC). Spawned characters replicate as actors. Rotating another player's pawn is done by that player's machine (a replicated counter tells it to turn), so its own prediction doesn't undo it.
Teleport, fly Run locally on the owner, so they work in standalone and for the listen server host. A client's teleport or fly is overridden by the server: both are single-player debug helpers.

Over a listen server, expect one movement correction on the client when the host shoots or rotates the client's pawn.

Other debug aids

These are not part of the component:

  • The movement debug shapes (DDCvar.DrawCharacterDebugShapes) are drawn by the Mover pawn and the Anim Blueprints.
  • DDCVar.CharacterPhysics.DrawDebug 1 draws the ragdoll's obstacle sweep and impact traces.
  • DDCVar.CharacterPhysics.DefaultProfile 1 turns on physical animation outside ragdoll (Ragdoll).

All debug console variables: Console variables.

Limitations

  • Shoot needs the characters hit to have a ragdoll system (BPI_RagdollSystem) and a mesh that blocks the shot's PhysicsBody trace; rotate and teleport need TeleportCharacter (BPI_SandboxCharacter_Pawn); fly needs the pawn's Get_MovementModeName and Set_MovementModeByName, else a CharacterMovementComponent on the owner.
  • The demo shot is a debug tool, not a weapon system: no damage, ammunition or effects.
  • Teleport and fly don't work for network clients (see Networking).