Physical Reactions
Documentation Unreal Engine Combat Framework Physics Hit Reactions
Move a character's bones under physics when a blow lands, and drop the body limp when it dies, on enemies and the player alike: reactions named in a set, played from a hit or a Blueprint, under a limit for the whole level.
A punch snaps a head back, a cut sways a shoulder, and a body that dies falls the way the blow threw it, enemy or player. The animation keeps playing underneath; physics borrows the bones for a moment and hands them back.
Set it up
5 minutes- 1
Create a reaction set
Right-click in the Content Browser and pick UCF > Damage and Defense > Physical Reaction Set. Name itPhysReact_MyEnemy. - 2
Add a flinch
Open the set and set Authoring Mesh to the character's skeletal mesh, so every bone field offers a dropdown. Add a row to Reactions, name itFlinch, and add two groups to its Regions: one with Root Bonespine_01at a Peak Blend Weight of 0.65, and one with Root Boneneck_01at 1 and a Start Delay Seconds of 0.03. Set Push Bone tohead.DetailsPhysReact_MyEnemyAuthoring
Authoring MeshSKM_UCF_Manny_SimpleReactions
Reactions1 Array elementFlinchReaction NameFlinchRegions2 Array elementsspine_01Root Bonespine_01Whole BodyExcluded Bones0 Array elementsPhys Anim ProfileNoneConstraint ProfileNonePeak Blend Weight0.65Debug NameLower SpineStart Delay Seconds0.00Attack Seconds0.06Hold Seconds0.10Release Seconds0.25EnvelopeNoneIndefinitePriority0Strength Scale1.0neck_01Root Boneneck_01Whole BodyExcluded Bones0 Array elementsPhys Anim ProfileNoneConstraint ProfileNonePeak Blend Weight1.00Debug NameNeck And HeadStart Delay Seconds0.03Attack Seconds0.06Hold Seconds0.10Release Seconds0.25EnvelopeNoneIndefinitePriority0Strength Scale1.0Apply ImpulseImpulse at Hit LocationVelocity ChangePush BoneheadRe-hit Blend0.12Min QualityFullRagdoll
Default RagdollRoot BoneNoneWhole BodyExcluded Bones0 Array elementsConstraint ProfileNoneStarting Tension1.0Tension Fade0.8Blend in Seconds0.05Collision ProfileRagdollSettle PolicyKeep AsleepCarry Owner with BodyBody Fall Effect Speed120Settle on Dedicated ServerLate Join DropPick bones and profiles from the dropdowns once Authoring Mesh names the character's skeletal mesh. Push Bone sends every blow to the head, wherever it landed. - 3
Give the enemy the component
Open the enemy's Blueprint and select its UCF Physical Reaction, which UCF Enemy Character Base creates as PhysicalReactionComponent, and set its Reaction Set toPhysReact_MyEnemy. An enemy built straight on Enemy Character Base carries none, and neither does the player's character: on those, click Add and pick UCF Physical Reaction first.DetailsUCFPhysicalReactionUCF
Physical Reaction
Reaction SetPhysReact_MyEnemyMesh Component TagNoneRespect Physics BudgetReplicate OrdersManage Mesh CollisionNothing moves until something orders a reaction or a fall, and the component costs nothing while nothing runs. Manage Mesh Collision sits under the advanced arrow. - 4
Play it when a blow lands
Open the damage config of the player's weapon that hits the enemy, add an entry to Hit Effects, and pick UCF Play Physical Reaction. Set Reaction Name toFlinchand Force to 2000.Damage_MyFists▾Hit Effects, Index [ 0 ]Reaction NameNoneForce0The player's two unarmed damage configs push at 2000 and 2800; the sword's pushes far more gently, so a cut sways a body a punch snaps back. The same entry on an enemy weapon's damage config flinches the player, once the player's character carries the component too. - 5
Press Play and punch the enemy
Wherever the punch lands, the enemy's head snaps back and the chest follows, while its legs keep walking. A moment later the bones are back on the animation. The demo's training dummies,BP_UCF_HitDummyin the hallway, do the same withPhysReact_UCF_Enemy.
How a reaction moves the body
A reaction is a list of groups. A group takes hold at its Root Bone and covers every physics body under it, so a group on the upper arm moves the whole arm and a group on the spine moves the upper body. Each group rises from the animation to its Peak Blend Weight, holds there, and eases back:
Flinch
0.0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
spine_01
Lower Spine, 0.65
neck_01
Neck And Head, 1
| Setting | Does |
|---|---|
| Root Bone | Where the group takes hold. That bone and every physics body below it move together. A bone with no physics body of its own still works when something under it has one. |
| Whole Body | Take every physics body on the mesh instead, for a full collapse. |
| Excluded Bones | Parts of the group to leave on the animation, named by the bone at their top. Name both collar bones to keep two hands on a two-handed weapon while the torso takes the hit. |
| Peak Blend Weight | How far the group hands its pose to physics at its strongest, from 0 (animation) to 1 (physics). About 0.9 on the struck limb, 0.5 on the spine and 0.15 on the legs reads as a body absorbing a blow while it walks. |
| Phys Anim Profile | The physical animation settings from the mesh's Physics Asset that drive the group, so it resists rather than hanging limp. None leaves it with no motors. |
| Constraint Profile | A joint limit set from the Physics Asset for the length of the reaction: loosen a shoulder for a big flinch, tighten a neck so a head does not fold. None keeps the Physics Asset's own joints. |
| Start Delay Seconds | How long the group waits before joining in. |
| Attack Seconds | How long it takes to rise to its peak. Under about 0.02 seconds the change lands in one frame and reads as a snap. |
| Hold Seconds | How long it stays at its peak. |
| Release Seconds | How long it takes to ease back. Under about a tenth of a second reads as a snap back. |
| Envelope | A curve that shapes the whole group instead of the three timings, for a shape they cannot make, such as a double hitch. It runs for as long as the three timings add up to. |
| Indefinite | Hold the group at its peak until something stops the reaction, for a limb that has to stay dead. |
| Debug Name | A name for the group in log lines and validation messages. |
Tune strength in the Physics Asset editor, where the preview shows the result: a reaction only names the profiles authored there.
Three settings on the reaction itself decide what the blow's push does:
| Setting | Does |
|---|---|
| Apply Impulse | Push the struck body with the blow. Off lets the motors alone shape the reaction. |
| Impulse at Hit Location | Land the push at the point of contact, which adds spin, rather than at the body's center. On for a blade clipping a shoulder, off for a shockwave. |
| Push Bone | The bone that takes every push, wherever the blow landed. head makes a punch to the arm or the chest throw the head back. None pushes the bone that was struck. |
Play a reaction
From a hit. UCF Play Physical Reaction in a damage config's Hit Effects plays its Reaction Name on whatever the attack strikes, enemy or player, pushed along the direction the blow traveled at Force. A target with no UCF Physical Reaction component is left alone, and 0 Force plays the reaction with no push. The groups come from the reaction's own Root Bones; the bone the sweep struck only decides where the push lands when Push Bone is None.
From a Blueprint. Play Reaction takes a reaction name, the struck bone and a push, and Play Reaction for Hit reads the bone and the point of contact off a hit result. Both return a handle: pass it to Stop Reaction to ease that reaction back early, or call Stop All Reactions. On Physical Reaction Started and On Physical Reaction Ended fire around each reaction, for a sound or a camera shake to go with it.
A paired action can drop one of its roles into a ragdoll with its Ragdoll event, and a killing blow drops its target with the Ragdoll option of the Deal Damage that kills it; see Pairing Editor.
Drop the body when it dies
The component does not watch for death: a ragdoll starts when something orders it. Start Default Ragdoll drops the body with the set's Default Ragdoll, so a death path is one node. Where that node goes depends on the character: an enemy's AI controller calls it from On Death, and a character built on the UCF character base from On Damage Taken.
| Default Ragdoll setting | Does |
|---|---|
| Root Bone | Top of the part that goes limp, used while Whole Body is off. Naming a lower bone drops fewer bodies and costs less. |
| Whole Body | Drop every physics body. On by default. |
| Excluded Bones | Parts to keep on the animation, such as a held prop or a cloak. |
| Constraint Profile | A joint set from the Physics Asset for the limp body: its limits stop joints bending the wrong way, and its Orientation Drives give the body a slight pull toward a relaxed pose as it falls. The demo's is Ragdoll. |
| Starting Tension | How much of that pull the body starts its fall with, from 0, a dead weight, to 1, the strengths the Physics Asset sets. 1 by default. |
| Tension Fade | How long the pull takes to ease away, so the body goes limp as it lands. 0.8 seconds by default; 0 keeps it until the body comes to rest. Either way the pull is gone once the body rests. |
| Blend in Seconds | How long a partial ragdoll takes to hand its pose to physics. A fall from the whole body goes limp at once. |
| Collision Profile | The collision the mesh switches to while limp, Ragdoll by default, so the body lands on the floor. The camera keeps seeing the mesh the way it did, and the old collision comes back when the ragdoll stops. |
| Settle Policy | Keep Asleep leaves the body where it fell at almost no cost, and a later hit can wake it. Stop Simulating switches the bodies off, cheaper still, but the body stands back up on its animation. |
| Carry Owner with Body | Bring the character's collision along with the falling body and stop it walking, so anything asking where the character is finds the corpse. |
Start Ragdoll takes settings of its own for a knockdown or a special death, and both nodes take a push to throw the body. Either node called on a body already falling changes nothing. Stop Ragdoll hands the skeleton back to animation, snapping to the current pose, so call it as the body is hidden or removed. Settle Ragdoll puts a moving body to rest early. On Ragdoll Phase Changed reports Simulating, Settling and Settled: reaching Settled is the moment for a dissolve or a despawn.
Keep a big fight inside its budget
UCF Physics Budget caps how much physics a level runs at once: 8 moving ragdolls and 24 reactions to start. An order past the cap is turned down, and nothing already running is cut short to make room. A ragdoll counts until it comes to rest.
A character far from the camera runs less physics. Each reaction's Min Quality decides how far out it still plays:
| Min Quality | Plays |
|---|---|
| Full | Within 25 m of the camera. Suits a small flinch nobody could see from further. |
| Reduced | Within 120 m. |
| Off | At any distance. |
Ragdolls play at any distance. Call Set Limits on the UCF Physics Budget from the game mode to give one level its own caps; until then they come from the console variables below. Untick Respect Physics Budget on a component to leave it out of the count, such as on a boss whose death has to fall however busy the level is.
On an enemy: flinch and fall
UCF Enemy Character Base carries the component and drops the body limp on the hit that empties its health, so an enemy built on it flinches and falls once the component's Reaction Set is set. An enemy built straight on Enemy Character Base does neither on its own: it needs the component for both, and one node on its AI controller for the fall.
The flinch. Point the Reaction Set of the enemy's UCF Physical Reaction at a Physical Reaction Set, adding the component first on an enemy built straight on Enemy Character Base, as in the quick start. The player's UCF Play Physical Reaction hit effect then plays on it; nothing on the enemy calls Play Reaction itself.
The fall. On UCF Enemy Character Base the fall needs nothing more: the base calls Start Default Ragdoll as the killing blow lands, and that blow's own physical reaction throws the body. On an enemy built straight on Enemy Character Base, order it yourself. When the enemy's health empties, UCF Combat Controller on its AI controller (with Auto Handle Death on Health Depleted on, its default) cancels the running action and reaction, stops the brain and the melee trace, unregisters the combat role, then fires On Death; Vitals covers that shutdown. The body is left standing. In the AI controller's Blueprint, built on Enemy Controller Base, add Event On Death, reach the body with Get Controlled Pawn, and drop it:
BP_MyEnemyController · Event Graph
Event On Death
Get Controlled Pawn
Target is Controller
Targetself
Return Value
Find Physical Reaction Component
Actor
Return Value
Start Default Ragdoll
Target is UCF Physical Reaction
Target
Impulse BoneNone
Impulse0, 0, 0
Return Value
A controller of your own that carries UCF Combat Controller binds that component's On Death instead.
Order the fall from On Death rather than from On Vital Depleted on the pawn's Vitals. On Death fires once the AI has stopped, the point where the body is safe to ragdoll, and only on the server, where the fall has to start. On Vital Depleted fires on every machine, so a Blueprint that uses it gates the call with Has Authority.
Bringing one back. Handle Revive puts the AI back in control but does not end the ragdoll: call Stop Ragdoll on the pawn's component as well.
In the demo. Every demo enemy reacts and falls limp:
BP_UCF_EnemyCharacter, the parent of every demo enemy and boss, sets its component's Reaction Set to PhysReact_UCF_Enemy. A punch or a sword cut flinches any of them, the killing blow drops the body the way the blow threw it, and the sword execution throws the dual-sword boss's body. The training dummies, BP_UCF_HitDummy, carry one too, and are built on the UCF character base, the route below.On the player: flinch and fall
The flinch. Add UCF Physical Reaction to the player's character and give it a set. A blow whose damage config carries UCF Play Physical Reaction then flinches the player, whoever threw it. The demo's
BP_UCF_Character carries one with PhysReact_UCF_Default.The fall. On a character built on the UCF character base, the player's or any other, On Damage Taken reports every hit after the pools drain, and Was Fatal on its Result says the hit emptied the health pool (Vitals). One node drops the body:
BP_MyCharacter · Event Graph
Event On Damage Taken
Damage Info
Result
Break UCFDamage Result
UCFDamage Result
Damage Applied
Additional Vital Damage Applied
Was Fatal
Result Tags
Branch
Condition
True
False
Find Physical Reaction Component
Actorself
Return Value
Start Default Ragdoll
Target is UCF Physical Reaction
Target
Impulse BoneNone
Impulse0, 0, 0
Return Value
The demo's training dummies,
BP_UCF_HitDummy, are built on this base.One system, both layers
- One hit effect, either direction. Enemy swings and player swings both run their damage config's Hit Effects, so UCF Play Physical Reaction on the player's weapon flinches an enemy carrying the component, and the same entry on an enemy's weapon flinches the player.
- One budget. UCF Physics Budget counts the whole level, enemies and the player together: at the defaults, 8 moving ragdolls and 24 reactions shared between them. Untick Respect Physics Budget on the player's component to keep the player's own reactions out of the count.
- Two things called a reaction set. An enemy's Reaction Set picks its parries, dodges and counters (Reaction System). A Physical Reaction Set moves bones. The Reaction Set field on the UCF Physical Reaction component takes the second kind only.
Debug it
When an order is turned down, On Physical Reaction Refused fires with the reaction's name and a reason. Bind it while building content:
| Reason | Fix |
|---|---|
| Unknown Reaction | The Reaction Set has no reaction under that name, or no Reaction Set is assigned. |
| No Bodies to Move | No group found a physics body: the bones it names have none on this mesh, Excluded Bones took them all, or the group covers only the pelvis. |
| No Physics Asset | The mesh has no Physics Asset. |
| Mesh Collision Has No Physics | The mesh's collision answers queries only. Turn Manage Mesh Collision back on, or set the mesh to Query And Physics. |
| No Skeletal Mesh | The actor has no skeletal mesh, or Mesh Component Tag names none. |
| Physics Bodies Not Ready | The mesh is still building its bodies, a frame or two after a spawn or a mesh swap. |
| Budget Full | The level is at its cap. |
| Out Of Range | The character is too far from the camera for the reaction's Min Quality. |
| Component Inactive | The component was switched off with Set Active. |
Physical reactions log under
LogUCFPhysicalReaction, which warns once about a setup mistake, such as a group whose bone has no physics body or a profile missing from a body in the Physics Asset. Log LogUCFPhysicalReaction Verbose also reports budget and distance refusals. Saving a Physical Reaction Set checks every bone and profile name against its Authoring Mesh. stat UCFPhysics shows how many groups, bodies and ragdolls are running, and how many orders the budget refused.An enemy that takes hits without flinching, and reports no refusal, has no Reaction Set on its component, or no component at all on an enemy built straight on Enemy Character Base, or the attacker's damage config is missing UCF Play Physical Reaction.
| Console variable | Default | Sets |
|---|---|---|
UCF.Physics.MaxAwakeRagdolls | 8 | How many ragdolls may be moving at once in a level. |
UCF.Physics.MaxActiveReactions | 24 | How many reactions may run at once in a level. |
UCF.Physics.QualityFullDistance | 2500 | How far from the nearest view, in centimeters, a character still plays every reaction. |
UCF.Physics.OffDistance | 12000 | How far, in centimeters, it still plays reactions whose Min Quality is Reduced. |
UCF.Physics.ForceQuality | -1 | Forces every character's detail: -1 by distance, 0 Full, 1 Reduced, 2 Off. |
AdvancedOverlapping groups and a second hit
- Overlap. A bone covered by two groups, from one reaction or two, takes the larger weight, so a light knock landing on a heavy stagger cannot weaken it. Where the groups name different profiles, the higher Priority decides, and on a tie the group that started later.
- Strength Scale. One motor strength covers the whole mesh: the largest Strength Scale among the running groups that name a profile.
- A second hit. A blow landing on bones still moving from the last one rises from the weight they already show, over Re-hit Blend (0.12 seconds) or its Attack Seconds if longer, and spreads its push across the same time, so it blends in rather than jumping. A group with an Envelope keeps its curve. 0 restores each group's Attack and an instant push.
- The pelvis. A reaction does not move the mesh's root body (the pelvis on the mannequin), since the engine carries the whole mesh with that body while it simulates. A group on the pelvis moves the spine and legs under it; only a ragdoll moves the pelvis itself.
- Velocity Change makes a hand and a torso move the same distance under one push. It applies only while Impulse at Hit Location is off.
- Bones letting go. Bodies joined to each other return to the animation together once the last of them lets go, so an early group ending under a later one does not pop the chain.
MultiplayerWhat every player sees
- Order on the server. A reaction or a ragdoll ordered on the server reaches every machine, and each machine runs its own physics from it, so bodies land in similar rather than identical poses. The hit effect runs on the server for that reason, and so do an enemy controller's On Death and the character base's On Damage Taken, so both death graphs above start the fall where it should. Called on a client, Play Reaction plays on that machine alone.
- A flinch travels as one small message that can be lost under packet loss; nothing replays it. A fall is replicated state, so a player who joins later still finds the body on the floor. Late Join Drop drops that body at its resting place over about a second on the joiner's machine; off, it stands in its animation pose there.
- The actor must replicate. With Replicate Orders on, an actor that does not replicate logs a warning, since no order can leave the server. Untick Replicate Orders for a single-player game.
- A fall carries its settings. Settings passed to Start Ragdoll travel with the fall, so every machine, a player who joins later included, drops the body the same way. Start Default Ragdoll sends none, and each machine reads the Default Ragdoll from its own Reaction Set, so keep the same set on every machine.
- Dedicated server. A server with no camera plays only reactions whose Min Quality is Off, but still sends every reaction to the players. With Settle on Dedicated Server on, the server plays the fall out too, so later joiners see the body where it landed.
- Distance and Stop Reaction stay on the machine they ran on: each player's machine judges its own camera distance. An order the server's own budget turns down reaches no one, so the server's limits decide for everyone.
C++C++
UUCFPhysicalReactionComponent(UCFFoundation) drives the bones;UUCFPhysicalReactionSetholdsFUCFPhysicalReactionrows ofFUCFPhysicalReactionRegiongroups and anFUCFRagdollSettings.UUCFPhysicsBudgetSubsystemis the per-world budget.- The component implements
IUCFPhysicsImpulseReceiver, so the UCF Apply Physics Impulse hit effect hands a push on a ragdoll to every machine's copy rather than the server's alone. UUCFPhysicalReactionHitEffect(UCF Play Physical Reaction) runs on the target side only, on the authority.UUCFPhysicalReactionComponent::FindPhysicalReactionComponentfinds the component, or a subclass of it, on any actor.AUCFEnemyCharacterBasecreates the component asPhysicalReactionComponentand callsStartDefaultRagdollfromHandleIncomingDamageon the hit that empties its health.- On an enemy,
UUCFCombatControllerComponent::OnDeathandAEnemyControllerBase::K2_OnDeath(the Blueprint On Death) fire at the end ofHandleDeath, on the server.HandleDeathdoes not unpossess the pawn and does not touch its mesh.