Physical Reactions

Documentation Unreal Engine Player Combat Physics Hit Reactions

Physical reactions move a character's bones under physics when a blow lands and drop the body limp when it dies: named reactions in a set, played from a hit or a Blueprint.


Set it up

5 minutes
  1. 1

    Create a reaction set

    Content Browser
    ▸ Content
    Right-click in the Content Browser, UPC, Damage and Defense, Physical Reaction Set.
  2. 2

    Add a flinch

    This flinch moves bones under physics and leaves the character's attack and actions alone; stopping the attack is the Hit Reactions ability, and both can run on one hit.
    The enemy's skeletal mesh needs a Physics Asset with bodies on the bones a reaction names; the demo mannequin's has them. Set Authoring Mesh to that mesh so the bone fields offer a dropdown, add a row to Reactions with two Regions, and set the fields below.
    PhysReact_MyEnemy
    ▾Details
    Authoring Mesh
    None▾
    Reaction NameNone
    Regions0 Array elements
    Push BoneNone
    Region [0] is the upper body; region [1] the neck and head. A body two regions share takes the larger weight, so the neck and head move at 1.
  3. 3

    Give the enemy the component

    Add UPC Physical Reaction to the enemy's Blueprint and set its Reaction Set to PhysReact_MyEnemy. An empty Mesh Component Tag drives the actor's main skeletal mesh.
    Details
    UPCPhysicalReaction
    UPC
    Physical Reaction
    Reaction Set
    PhysReact_MyEnemy
    Mesh Component Tag
    None
    Respect Physics Budget
    Replicate Orders
    Manage Mesh Collision
    Nothing 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. 4

    Play it when a blow lands

    In Damage_MySword, the damage config from Melee Trace, add UPC Play Physical Reaction to Hit Effects.
    Damage_MySword
    ▾Hit Effects, new row (UPC Play Physical Reaction)
    Reaction NameNone
    Force0
    Force 2000 snaps the head back like a punch.
  5. 5

    Press Play and strike the enemy

    Within 25 m of the camera (the default Min Quality, see the budget below), the enemy's head snaps back and the chest follows while its legs keep walking, then the bones return to the animation.

How a reaction moves the body

A reaction is a list of Regions. A region takes hold at its Root Bone and moves every physics body under it, rising from the animation to its Peak Blend Weight (0 animation, 1 physics), holding, and easing back. Push Bone takes the blow's push wherever it landed; None pushes the struck bone.
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
Each bar is a region, from its start until its bones are back on the animation; the dashed rise is its Attack Seconds. Starting the neck a little after the spine sends the blow up the body.
A region with Phys Anim Profile None hangs loose on the Physics Asset's joints; name a profile from the Physics Asset to make it resist.

Play a reaction

  • From a hit, as in the quick start: the push follows the path the weapon swept into the body, so a slash across the left shoulder throws the body to its right. The effect skips a target without the component, and 0 Force plays the reaction with no push. A dead body (Can be Damaged off) stays still unless the effect has Run on Inert Hits ticked.
  • From a Blueprint: Play Reaction takes a name, the struck bone and a push; Play Reaction for Hit reads the bone and point off a hit result. Both return a handle for Stop Reaction; Stop All Reactions ends them all. On Physical Reaction Started and Ended bracket each one, for a sound or a camera shake.
  • From a paired action: its Ragdoll event (Paired Actions).

Drop the body when it dies

Nothing starts a ragdoll on its own. On a character built on the UPC Character Base, On Damage Taken tells you a hit emptied health, and Start Default Ragdoll drops the body with the set's Default Ragdoll:
BP_MyEnemy · Event Graph
Event On Damage Taken
Damage Info
Result
Break UPCDamage Result
UPCDamage 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 UPC Physical Reaction
Target
Impulse BoneNone
Impulse0, 0, 0
Return Value
The graph passes no push: the killing blow's own UPC Play Physical Reaction runs after On Damage Taken, so its push throws the falling body the way the blow went.
Start Ragdoll takes settings of its own for a knockdown or a special death; both take a push, and a body already falling keeps its fall. Stop Ragdoll snaps the skeleton back to the animation, so call it as the body is hidden or removed. On Ragdoll Phase Changed reports Simulating, Settling and Settled (no part moved 5 cm for a second, or 15 s after the fall), the moment for a dissolve or a despawn; Settle Ragdoll forces it early.

Keep a big fight inside its budget

UPC Physics Budget caps a level at 8 moving ragdolls and 24 reactions; an order past the cap is refused without cutting anything running, and a ragdoll counts until it rests. Min Quality, a field on each row under Reactions, sets how far from the camera that reaction still plays; Off means no distance limit. A flinch that should play past 25 m needs Reduced or Off:
Min QualityPlays within
Full (the default)25 m of the camera
Reduced120 m
OffAny distance, a dedicated server included
Ragdolls play at any distance. The UPC.Physics console variables hold these numbers, and UPC.Physics.ForceQuality (-1 by distance, 0 Full, 1 Reduced, 2 Off) forces one detail. Set Limits, called from the game mode, gives a level its own caps; untick Respect Physics Budget on a boss whose death must fall however busy the level is.

Debug it

On Physical Reaction Refused fires with the reaction's name and a reason; bind it while building content. LogUPCPhysicalReaction warns once per setup mistake, such as a bone with no physics body or a profile missing from the Physics Asset; at Verbose it also reports budget and distance refusals. Saving a set checks every name against its Authoring Mesh. stat UPCPhysics counts the regions, bodies and ragdolls running and the orders refused.
AdvancedEvery region setting
SettingDoes
Whole Body, Excluded BonesTake every body on the mesh; or leave parts on the animation by their top bone, such as both collar bones to keep a two-handed grip.
Phys Anim Profile, Constraint ProfileThe Physics Asset motors that make the region resist, and a joint set to loosen a shoulder or stiffen a neck.
Start Delay, Attack, Hold, Release SecondsWhen it joins, rises (under 0.02 s snaps), holds and eases back (under 0.1 s snaps). Envelope is a curve in their place; Indefinite holds the peak until stopped.
Priority, Strength ScaleOn bones two regions share, the higher Priority's profile wins, then the later region. The largest Strength Scale sets the whole mesh's motors.
  • Apply Impulse pushes with the blow; Impulse at Hit Location lands it at the contact, adding spin (off for a shockwave); Velocity Change, with that off, moves a hand and a torso alike.
  • A second hit on a moving body starts its regions at their peak from the pose shown and spreads its push over Re-hit Blend (0.12 s; 0 pushes at once). A standing body at rest takes it at once.
  • A Root Bone without a physics body works while one hangs below it. The pelvis, the root body, moves only in a ragdoll, so a region on it moves the spine and legs.
  • Joined bodies return to the animation together, so a chain does not pop.
AdvancedRagdoll settings
SettingDoes
Root Bone, Whole Body (on), Excluded BonesWhat goes limp; a lower root costs less.
Constraint ProfileThe joint set while limp: limits, and Orientation Drives pulling toward a relaxed pose. The demo's is Ragdoll.
Starting Tension (1), Tension Fade (0.8 s)How much pull the fall starts with and how long it eases away; 0 keeps it until the body rests.
Blend in Seconds (0.05)A partial ragdoll's hand-over; a whole-body fall goes limp at once.
Collision ProfileRagdoll while limp, the camera's view of the mesh unchanged; put back on Stop Ragdoll.
Settle PolicyOnce the body settles: Keep Asleep leaves it lying, Stop Simulating costs less but stands it back up.
Carry Owner with Body (on)Move the character with the body; characters and the camera pass through it, swings still land.
Body Fall Effect Speed (120 cm/s)How hard the pelvis must land to ask its anim effects once for UPC.AnimEffect.BodyFall, a body-fall sound.
MultiplayerWhat every player sees
  • A server order reaches every machine, and each runs its own physics, so bodies land in similar poses. Play Reaction on a client plays there alone.
  • A flinch is one message packet loss can drop. A fall is replicated with its settings, so a later joiner finds the body down, collapsing at its resting place under Late Join Drop and standing there with it off. Start Default Ragdoll sends no settings, so keep one Reaction Set on every machine.
  • With Replicate Orders on, the actor must replicate, or it warns; untick it for single player.
  • A dedicated server plays only Min Quality Off reactions but sends them all; Settle on Dedicated Server plays falls out there for joiners.
  • Camera distance and Stop Reaction stay per machine; an order the server's budget refuses reaches no one.
C++C++
  • UUPCPhysicalReactionComponent (UPCFoundation) drives the bones; UUPCPhysicalReactionSet holds FUPCPhysicalReaction rows of FUPCPhysicalReactionRegion regions and an FUPCRagdollSettings. UUPCPhysicsBudgetSubsystem is the per-world budget.
  • The component implements IUPCPhysicsImpulseReceiver, so UPC Apply Physics Impulse pushes a ragdoll on every machine's copy.
  • UUPCPhysicalReactionHitEffect (UPC Play Physical Reaction) runs target side, on the authority; FindPhysicalReactionComponent finds the component or a subclass on any actor.
AdvancedTroubleshooting
ReasonFix
Unknown ReactionNo reaction by that name, or no Reaction Set.
No Bodies to MoveThe region's bones carry no physics body, Excluded Bones took them all, or it covers only the pelvis.
No Physics AssetGive the mesh one.
Mesh Collision Has No PhysicsTurn Manage Mesh Collision back on, or set the mesh to Query And Physics.
No Skeletal MeshThe actor has none, or Mesh Component Tag names none.
Physics Bodies Not ReadyThe mesh is building its bodies, a frame or two after a spawn or mesh swap.
Budget Full, Out Of RangeThe level is at its cap, or the character is too far for the reaction's Min Quality.
Component InactiveSet Active switched the component off.