Skip to content

Ragdoll and interactions

GASPALS has two ragdoll implementations, one per pawn type:

CMC pawn Mover ragdoll pawn
Pawn SandboxCharacter_CMC SandboxCharacter_Mover_Ragdoll (child of the Mover pawn)
Implementation AC_RagdollSystem component A Mover movement mode (BP_MovementMode_Ragdoll) plus a Physics Control component
Input X toggles ragdoll R ragdolls, Space gets up
Get-up Back to movement Get-up animations chosen from the pose (front, back, roll)
Physical animation No Yes: the body reacts to hits and obstacles while animating
Interactions No Takedowns and shoves between characters, demo shooting and spawning
Level DefaultLevel (N to the CMC pawn) RagdollLevel

CMC ragdoll (AC_RagdollSystem)

/GASPALS/Systems/RagdollSystem/AC_RagdollSystem. Press X (IA_Ragdoll) to toggle.

Start: the owner calls StartRagdoll, which asks the server (Server_StartRagdoll) to multicast it to everyone. Each machine stops montages, turns the capsule's collision off, switches the mesh to physics (Ragdoll profile, simulating the bodies below the pelvis), and sets the movement mode to none. OnRagdollStarted fires.

Stop: StopRagdoll reverses it the same way and fires OnRagdollEnded.

While ragdolling the CMC accepts the client's position (client-authoritative flags), so the capsule follows the body without corrections. The camera system listens to the two dispatchers to switch to the ragdoll perspective (see Camera).

Settings and functions: Ragdoll reference.

Mover ragdoll pawn

SandboxCharacter_Mover_Ragdoll is the player pawn of RagdollLevel (game mode GM_Sandbox_Ragdoll). It adds:

  • a Physics Control component (physical animation): when not ragdolling, the body follows the animation with physics strengths, so it reacts to bumps; DDCVar.CharacterPhysics.DefaultProfile picks kinematic (0) or physical animation (1, default). An AC_PostABPTick helper updates the strengths from animation curves right after the Anim Blueprint runs.
  • the Ragdoll movement mode and the BP_MovementTransition_SuggestedMode transition;
  • interactions with other characters (takedowns, shoves) and demo tools.

Entering and leaving ragdoll

  1. R (IA_TriggerRagdoll) sets an injury state and, on the owner, writes a ragdoll request into the Mover input. The suggested-mode transition switches to the Ragdoll mode inside the simulation, so the owner and the server agree. (A server forcing a remote player into ragdoll queues the mode directly.)
  2. Every machine applies the ragdoll look when the mode changes: physics on, the Ragdoll physics profile.
  3. While ragdolling, the owner can roll the body with the move input; the roll travels in the input too. Remote ragdolls are pulled toward the replicated capsule so they stay in sync.
  4. Space on the ground leaves the ragdoll. The owner picks a get-up montage from the body's pose (lying on the back or the front, rolling) and sends it in the input; the server and the owner play it.

Takedowns and shoves

Near another character:

Input Action
Left Button Takedown: a paired takedown animation on both characters.
E Shove.

The interaction is matched with multi-character motion matching (MMI): the best paired animation for both characters' poses and positions is chosen, and both are warped into place. On a client, the initiator plays its part at once and asks the server (Server_TryCharacterInteraction), which checks the victim (walking, not already in a root-motion animation, within 3.5 m) and multicasts the interaction. Each machine sets up the participants (ignored collisions, tick order, the animation contexts the Anim Blueprint uses for constraints).

Demo tools

Hold aim (Right Button), then:

Input Action
Left Button Shoot: the character hit goes ragdoll with an impulse.
E Spawn a character where you aim, or rotate the one you aim at.

Clients send these to the server with the view; the server traces, applies the ragdoll and multicasts the impulse.

Physics obstacles

RagdollLevel has moving obstacles (bumpers, hammers, turnstiles, moving platforms) on the Obstacle collision channel, which the Ragdoll profile blocks. Walk into them with physical animation on, or ragdoll into them.

Networking summary

Event CMC pawn Mover ragdoll pawn
Start / stop Server RPC, then reliable multicast Mover input request and transition; cosmetics on mode change
Roll n/a Mover input
Get-up n/a Montage chosen by the owner, sent in the input, played on server and owner
Interactions n/a Client predicts, server validates, reliable multicast

In a listen server test, expect one correction for each of: a takedown or shove from the host on a client, a shot from the host, the host rotating a client. Ragdoll bodies agree within a few centimeters across machines.

Limitations

  • The two implementations are separate: the Mover pawn without the ragdoll child has no ragdoll, and the CMC pawn has no physical animation or interactions.
  • Takedowns and shoves are on the Mover ragdoll pawn only.
  • The CMC ragdoll simulates the bodies below the pelvis and has no get-up animation.