Ragdoll and interactions¶
Both pawns use the same two components, each a shared base with one small adapter per movement type:
| Component | Base (shared) | Mover adapter | CMC adapter |
|---|---|---|---|
Ragdoll (AC_RagdollSystem on the pawn) | AC_RagdollSystem_Base | AC_RagdollSystem_Mover | AC_RagdollSystem_CMC |
Takedowns and shoves (AC_InteractionSystem) | AC_InteractionSystem_Base | AC_InteractionSystem_Mover | AC_InteractionSystem_CMC |
The ragdoll base holds the input, the get-up choice, obstacle hits, the automatic get-up of characters without a player, impact sounds, the listener notifications and the Physics Control profiles. The adapters only talk to the movement component. The pawns differ in a few places:
| CMC pawn | Mover pawn | |
|---|---|---|
| Pawn | SandboxCharacter_CMC | SandboxCharacter_Mover |
| Ragdoll state | Movement mode none; the server moves the capsule along with the body | The Ragdoll Mover mode (BP_MovementMode_Ragdoll) |
| Input | X ragdolls; on a floor, X or Space gets up | same |
| Entry | Keeps the movement momentum (Inherited Velocity Scale); the legs collide with each other | The Ragdoll physics profile; the legs collide with each other |
| Get-up | Animation chosen from the pose (front, back, rolling) like the Mover; with an item in hand, the held-item montages (Use Held Item Get Ups) | Animation chosen from the pose (front, back, rolling) |
| Physics Control (physical animation, settling) | Yes; physical animation off by default (kinematic) | same |
| Characters without a player | Get up by themselves (below) | same |
| Takedowns and shoves | Yes, with Mover or CMC characters (below) | same |
| Debug tools | Yes (debug tools) | same |
| Level | Any; RagdollLevel has targets and obstacles | same |
On both pawns the gamepad uses D-pad right to ragdoll and D-pad right or A to get up (Controls). While a character ragdolls, the camera system switches to its ragdoll view (see Camera). Each pawn reaches the components only through small class-lookup functions (Ragdoll_Initialize, Interaction_Initialize), so either component can be removed (Turning systems on and off).
Requirements and setup warnings¶
The ragdoll component checks its setup at initialization. When something is missing it shows an orange on-screen message for 10 seconds and writes it to the log:
| Message | Cause | Result |
|---|---|---|
| "<Pawn>: AC_RagdollSystem needs the pawn, its character mesh and its capsule (InitializeSystem). The ragdoll is off." | The component is not on a character with a mesh and a capsule. | The ragdoll stays off. |
| "<Pawn>: no Physics Control component on the pawn. The ragdoll works without physical animation, settling or roll." | The pawn has no PhysicsControl component (with PCA_SandboxCharacter). | The ragdoll works as a plain limp ragdoll: no physical animation, settling or roll. |
To add the Physics Control component to your own pawn, see Using your own pawn.
Automatic get-up¶
A character that no player controls (a placed character, an AI, a spawned character) gets up by itself, on both pawns. On the server, while it ragdolls, the component counts the time the body moves slower than Auto Get Up Max Speed, and counts back down while it moves faster, so a short twitch of a settling body doesn't restart the wait. After Auto Get Up Delay it calls RequestGetUp; the count restarts at each get-up. If the body is not on a floor yet, it tries again after another delay. Player characters wait for the get-up input. Settings on the ragdoll component (AC_RagdollSystem_Base, Ragdoll > Get Up):
| Setting | Default | Use |
|---|---|---|
| Auto Get Up | true | Off: characters without a player stay down until something calls RequestGetUp (below). |
| Auto Get Up Delay | 3 | Seconds the body must rest before getting up. |
| Auto Get Up Max Speed | 30 | Speed (cm/s) of the spine_05 body under which the body counts as resting. A body at rest still jitters, often above 10 cm/s; a low value lets that jitter keep the character down for many seconds. |
CMC ragdoll (AC_RagdollSystem_CMC)¶
/GASPALS/Systems/RagdollSystem/AC_RagdollSystem_CMC. Press X (IA_Ragdoll) to ragdoll. While ragdolling, X again or Space (the pawn's jump input) gets up, through RequestGetUp (see Get-up input): only once the body rests on a floor.
Start: the owner calls StartRagdoll, which asks the server (Server_StartRagdoll) to multicast it to everyone. Each machine stops montages, makes the capsule query only and ignore pawns (no physics contact with the body or other characters; overlaps, such as the zero-gravity zone's, keep working), switches the mesh to physics (Ragdoll profile, simulating the bodies below the pelvis), applies the entry physics (ApplyEntryPhysics, below), and sets the movement mode to none. OnRagdollStarted fires.
Entry physics: right after the bodies start simulating, and before the movement mode is cleared, the bodies get the pawn's velocity times Inherited Velocity Scale, so a running character keeps its momentum instead of dropping in place, and collision is turned on between the left and right leg bodies so the legs don't pass through each other (the Mover ragdoll profile does the same for the legs). Settings (Ragdoll > Entry; the leg bones on the base, the velocity scale on the CMC adapter), set per pawn because the bone names depend on the skeleton:
| Setting | Default | Use |
|---|---|---|
| Inherited Velocity Scale | 1.0 | Share of the movement velocity the ragdoll starts with. 1 keeps the momentum, 0 drops in place. |
| Left Leg Bones | thigh_l, calf_l, foot_l | Bodies of the left leg. |
| Right Leg Bones | thigh_r, calf_r, foot_r | Bodies of the right leg; each collides with each left leg body. |
Stop: StopRagdoll reverses it the same way and fires OnRagdollEnded. Each machine turns physics off and puts the mesh back where it sat on the capsule when the ragdoll started (CacheMeshTransform / RestoreMeshTransform: the simulated pelvis drags the mesh away during the ragdoll). The capsule and mesh get back the collision settings they had when the ragdoll started (cached by CacheCollisionState), so a pawn with its own collision setup keeps it. On the ground the pawn walks again and plays a get-up montage. Without an item in hand it comes from the pose-matched chooser the Mover uses (CHT_GetUpMontages: lying on the back or the front, rolling). With an item in a hand and Use Held Item Get Ups on, it comes from the held-item montages (Ragdoll > Get Up settings: right hand, left hand, two hands). The get-up keys only work on a floor; when your own Blueprint calls StopRagdoll directly in the air, the pawn falls with the body's last velocity.
While ragdolling, the server moves the capsule along with the body and replicates its location and rotation; the clients' copies follow it. The component tells the pawn's other components through BPI_RagdollSystemListener; the camera system uses it to switch to the ragdoll view. It tells the pawn's controller too: the demo NPCs' AI controller (AIC_NPC_SmartObject) stops their behavior while they are ragdolled, leaving a bench they had claimed, and starts it again once the get-up is over. Enable Ragdoll (Ragdoll > General) turns the system off, and the component can be removed from the pawn (Turning systems on and off). Characters without a player get up by themselves (Automatic get-up).
Settings and functions: Ragdoll reference.
Mover ragdoll¶
SandboxCharacter_Mover is the default player pawn of RagdollLevel and of every other level (game mode GM_Sandbox): the ragdoll, takedowns and debug tools work wherever it plays. It has:
- a Physics Control component (
PhysicsControl, with the Physics Control assetPCA_SandboxCharacterin/GASPALS/Characters/UEFN_Mannequin/Rigs): when not ragdolling,DDCVar.CharacterPhysics.DefaultProfilepicks kinematic (0, default: the body plays the animation exactly) or physical animation (1: every limb is a simulated body pulled toward the animation, so it reacts to contacts, but hands and arms can catch on walls, for example in cover). The value is read again whenever it changes, so you can try it from the console during play. AnAC_PostABPTickhelper updates the ragdoll strengths from animation curves right after the Anim Blueprint runs. - the Ragdoll movement mode and the
BP_MovementTransition_SuggestedModetransition, driven byAC_RagdollSystem_Mover.
Settings and functions: Ragdoll reference.
Entering and leaving ragdoll¶
- X (
IA_Ragdoll), when not ragdolling, callsTriggerRagdoll. On the owner it writes a ragdoll request into the Mover input, and the suggested-mode transition switches to the Ragdoll mode inside the simulation, so the owner and the server agree. (A server ragdolling a character it doesn't control, such as another player or a character without a player, queues the mode directly.) The montage options ofTriggerRagdoll/RequestRagdoll(Stop Active Montages, Montage Blend Out) only apply on the machine that triggers the ragdoll; the other machines stop the montages with Default Ragdoll Montage Blend Out. The adapter uses the mode named in Ragdoll Mode Name (Ragdollby default), so a renamed mode works when you set it there. - Every machine applies the ragdoll look when the mode changes: physics on, the
Ragdollphysics profile. - While ragdolling, the owner can roll the body with the move input; the roll travels in the input too. On slopes steeper than Ragdoll Auto Roll Slope Min (20 degrees) the body also rolls downhill by itself. Remote ragdolls are pulled toward the replicated capsule so they stay in sync.
- X again or Space leaves the ragdoll once the body rests on a floor (
RequestGetUp: theRagdollmode andHasFloor, thenExitRagdoll); a press in mid-air does nothing. Entering and leaving ragdoll put the capsule back on the collision profile the pawn was built with (GetDefaultCapsuleProfile, CharacterCapsule in the sample), which also clears a takedown's collision override. 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.
A Mover character that no player controls gets up by itself (Automatic get-up). When the ragdoll starts and ends, the component tells the pawn's other components and its controller through BPI_RagdollSystemListener; the camera system uses it for the ragdoll view.
Physics Control asset¶
The PhysicsControl component names its Physics Control Asset through a soft reference only, so in a packaged game the asset can be garbage-collected and the physics profiles (kinematic, physical animation, Ragdoll) stop applying. At initialization the ragdoll component loads whatever asset the component names and keeps it in the runtime variable Loaded Physics Control Asset (LoadedPhysicsControlAsset). If you copy the Physics Control setup into your own pawn, keep a hard reference to the loaded asset the same way.
Settling¶
The ragdoll's arms are pulled toward the animated pose, which keeps moving while the body lies still, so the hands would keep shaking. Once the body has stayed slower than Ragdoll Settle Speed for Ragdoll Settle Delay, the physics control strengths fade to zero over Ragdoll Settle Blend Time; when the body moves again (pushed, shot, rolled) they come back four times faster. Once settled, the body only counts as moving again above Ragdoll Settle Wake Speed: the limbs drop a little as the strengths fade, and with a single threshold that drop brought the strengths back, so bodies kept twitching on the ground and characters without a player took much longer to get up.
Settings on the ragdoll component (Ragdoll > Settle; they act only with a Physics Control component):
| Setting | Default | Use |
|---|---|---|
| Ragdoll Settle Speed | 15 | Body speed (cm/s) below which the ragdoll counts as still. |
| Ragdoll Settle Delay | 0.3 | Seconds below that speed before the strengths start fading. |
| Ragdoll Settle Blend Time | 0.5 | Seconds to fade the strengths to zero (coming back takes a quarter of it). |
| Ragdoll Settle Wake Speed | 60 | Body speed (cm/s) above which a settled ragdoll moves again (never below Ragdoll Settle Speed). |
Takedowns and shoves¶
AC_InteractionSystem on both pawns (/GASPALS/Systems/InteractionSystem). Near another character, without aiming:
| Input | Action |
|---|---|
Left Button (IA_Takedown, gamepad RT) | Takedown: a paired takedown animation on both characters. |
E (IA_Interact, gamepad Y) | Shove. |
The target can be a Mover or a CMC character. It must have an interaction component, be in a state that allows it (Mover: walking without a root-motion animation; CMC: on the ground), be within Interaction Search Radius (2 m), in front of you (Interaction Max Angle, 60 degrees), at about your height (Interaction Height Tolerance), with nothing in between. You must be able to start one yourself (same state, no montage playing). The victim's animation puts it into ragdoll partway through, and it gets up as usual. With aim held (Right Button or LT), the same keys are the debug tools' shot and spawn.
The interaction is matched with multi-character motion matching: the best paired animation for both characters' poses and positions is chosen (CHT_CharacterInteractionPSDs), and both are warped into place. On a client, the initiator plays its part at once and asks the server (Server_TryCharacterInteraction), which checks that the requester is one of the participants and every participant (in an interactable state, within Server Max Interaction Distance, 3.5 m), then multicasts the interaction. Each machine sets up the participants (ignored collisions, tick order, the animation contexts the Anim Blueprint uses for the hand constraints). The Mover adapter plays the montage through the Mover component (root motion); the CMC adapter plays it on the mesh. Both Anim Blueprints apply the paired animation's hand IK while it plays.
A takedown or shove key pressed just before a character comes into range is kept for Interaction Input Buffer Time (0.3 s) and fires as soon as one is, so pressing while running at a target works. While a character plays the instigator part, its body ignores other ragdolls, so the victim falls naturally instead of being pushed by the instigator's arms.
Pressing while running at a target picks the running (diving) takedowns and shoves, the tackle montages. For their dive they turn off the capsule's collision (BP_NotifyState_OverrideCapsuleCollision) and switch the movement mode (BP_NotifyState_OverrideMovementMode): a Mover character to its Override Movement Mode (Traversing), a CMC character to Flying, so the animation's root motion carries the capsule without gravity, then back to Falling at the end of the notify if it is still flying. Both characters ragdoll during the dive, and the get-up restores the capsule's collision profile.
Settings on the interaction component (Interaction categories): Enable Character Interactions, the input buffer, the search radius, height tolerance, angle and clearance capsule, the server distance check, and a debug sphere above the characters you can interact with (Interaction reference).
Demo tools¶
The AC_DebugTools component, on both pawns. 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. Settings (trace distances, impulse, spawn limit, an on/off switch) and the teleport and fly keys are on the Debug tools page.
Get-up input¶
Both pawns get up through BPI_RagdollSystem > RequestGetUp (returns bHandled). It ends the ragdoll and plays the get-up only while the character is ragdolling on a floor, and returns false otherwise, so a press in mid-air does nothing; press again after landing.
| CMC pawn | Mover pawn | |
|---|---|---|
| Implemented by | AC_RagdollSystem_CMC (body on the ground) | AC_RagdollSystem_Mover (Ragdoll mode and a floor) |
X (IA_Ragdoll) | The component's input event: ragdolling, RequestGetUp; else start the ragdoll | same |
Space (IA_Jump) | The pawn's jump input calls Ragdoll_RequestGetUp first, a wrapper that finds the component by class, so the pawn still compiles if the component is deleted | In the Ragdoll mode, the jump input calls RequestGetUp |
If you implement BPI_RagdollSystem on your own pawn or component, implement RequestGetUp too to support the get-up keys: unimplemented, it returns false and the keys do nothing.
Using the ragdoll from Blueprints¶
The ragdoll components answer the same interface, BPI_RagdollSystem. Get the one on an actor with Get Ragdoll System (BPFL_GASPALS); it returns None on an actor without a ragdoll (the interface calls then do nothing).
| Call | Use |
|---|---|
RequestRagdoll(bStopActiveMontages, MontageBlendOut, InjuryState) | Ragdoll the character. Returns false when the ragdoll system is turned off. InjuryState is an E_RagdollInjuryState value as a byte (None, Head_Face, Head_Back, Stunned, Body_Front, Limp, Groin); both adapters replicate it to the Anim Blueprint (it resets at the get-up). The montage options apply on the machine that calls it; the other machines stop montages with Default Ragdoll Montage Blend Out. |
ApplyRagdollImpulse(BoneName, Impulse) | Push one body of the ragdoll. Called on the server, every machine pushes its own copy. The component waits up to 1 second for the ragdoll to start, so you can call it right after RequestRagdoll. |
IsRagdollActive | True while the character ragdolls. |
RequestGetUp | Get up, only while ragdolling on a floor (see Get-up input). |
Call RequestRagdoll on the server (or on the owning client) in multiplayer: a client can only start the ragdoll of its own pawn.
Ragdoll from an animation¶
The anim notify BP_AnimNotify_TriggerRagdoll (/GASPALS/Blueprints/AnimNotifies) calls RequestRagdoll on the character playing the animation. The takedown and shove victim animations use it. To use it in your own montage:
- Open the montage, right-click the Notifies track at the frame where the character should fall, and choose Add Notify > BP_AnimNotify_TriggerRagdoll.
- Select the notify. In the Details panel set Stop Active Montages, Montage Blend Out and Ragdoll Injury State (the
RequestRagdollinputs above). - Save the montage, play it on either pawn (for example with Play Montage from your Blueprint), and check that the character falls into ragdoll at that frame and gets up with X or Space once it rests.
Physics obstacles¶
RagdollLevel has moving obstacles (bumpers, hammers, turnstiles, moving platforms, in /GASPALS/Levels/LevelPrototyping/Obstacles) on the Obstacle collision channel, which the Ragdoll profile blocks. Walk into them with physical animation on, or ragdoll into them.
The ragdoll component of a locally controlled pawn sweeps a sphere from the neck to between the feet every frame; an obstacle hit knocks it into ragdoll. Settings on the ragdoll component (Ragdoll > Obstacles):
| Setting | Default | Use |
|---|---|---|
| Ragdoll on Obstacle Hit | true | Off: obstacles only push the capsule. |
| Ragdoll Obstacle Object Types | Obstacle | Object types that knock the pawn over. |
| Ragdoll Obstacle Trace Radius | 15 | Radius of the sweep in cm. |
DDCVar.CharacterPhysics.DrawDebug 1 draws the obstacle sweep and the ragdoll's impact traces (Console variables).
Networking summary¶
| Event | CMC pawn | Mover pawn |
|---|---|---|
| Start / stop | Server RPC, then reliable multicast; the server moves the capsule with the body | Mover input request and transition; cosmetics on mode change |
| Roll | n/a | Mover input |
| Get-up | Played on every machine by the stop multicast | Montage chosen by the owner, sent in the input, played on server and owner |
| Interactions | Client predicts, server validates, reliable multicast | same |
Impulse (ApplyRagdollImpulse) | Server: reliable multicast, every machine pushes its own copy. Client: local copy only | Reliable multicast |
Over a listen server, expect one movement correction on the client for each of: a takedown or shove from the host on a client, a shot from the host at a client, the host rotating a client. Ragdoll bodies agree within a few centimeters across machines.
Limitations¶
- The CMC ragdoll simulates the bodies below the pelvis.
- The Mover ragdoll's bone names are those of the UEFN mannequin; the ragdoll always simulates the pawn's UEFN mesh, also when a retargeted character is shown (Characters).
- On the Mover pawn, the montage options of
TriggerRagdoll/RequestRagdollonly apply on the machine that triggers the ragdoll; the other machines use Default Ragdoll Montage Blend Out.
Related¶
- Movement for the Mover modes
- Debug tools
- Interaction reference
- Camera for the ragdoll view
- Networking
- Ragdoll reference