Skip to content

Replicating Hit Reacts

Jared Taylor edited this page Mar 18, 2025 · 12 revisions

Pathways

Important

Where your Hit React is triggered from in a multiplayer game can differ depending on the use-case and project setup

Here are some examples:

  • Play hit react when getting hit by a weapon (melee or rifle, etc.)
    • If your project uses GAS then the server applies a gameplay cue that contains a location and normal and possibly a bone and calls HitReact()
    • Otherwise the event that notifies all net roles that the server has applied damage will call HitReact() but this is now entirely project-dependent and up to you to determine the correct pathway
  • Play hit react when landing from a significant height
    • ACharacter::OnLanded() event is net predicted and occurs on all net roles, and can call HitReact()
  • Play hit react when running into a wall
    • ACharacter::MoveBlockedBy() event is net predicted and occurs on all net roles, and can call HitReact() but is not available to BP

Gameplay Cues

Important

This is the ideal place to trigger a HitReact if using GAS and the need for a HitReact stems from an ability event

Tip

In the simplest terms, a Gameplay Cue is used to send cosmetic events, and are replicated to simulated proxies by default
If you don't know what a Gameplay Cue is then read here for a full explanation

This is the gameplay cue used to create the showcase video:

UnrealEditor-Win64-DebugGame_2025-03-18_13-30-48

UnrealEditor-Win64-DebugGame_2025-03-18_13-31-16

The gameplay cue was triggered via the PushPawn push ability.

image

Triggers

Caution

This method is not recommended and primarily exists for extraordinary use-cases
Generally there should be no need for this because hit reacts should typically occur from events that are already replicated or even predicted

You do not need this guide unless you have a reason to perform hit reactions with a complete data set

Tip

All pertinent types have network serialization built in and are capable of being replicated

Warning

Sending all of this data frequently could be heavy in terms of net bandwidth cost

These data types are included with net serialization that can be used as triggers for hit reacts:

  • FHitReactInputParams bone simulation properties
  • FHitReactTrigger : public FHitReactInputParams all impulse properties
  • FHitReactTrigger_Linear : public FHitReactInputParams linear impulse properties
  • FHitReactTrigger_Angular : public FHitReactInputParams angular impulse properties
  • FHitReactTrigger_Radial : public FHitReactInputParams radial impulse properties

These data types have an associated trigger function:

  • FHitReactTriggerUHitReact::HitReactTrigger()
  • FHitReactTrigger_LinearUHitReact::HitReactTrigger_Linear()
  • FHitReactTrigger_AngularUHitReact::HitReactTrigger_Angular()
  • FHitReactTrigger_RadialUHitReact::HitReactTrigger_Radial()

Clone this wiki locally