-
Notifications
You must be signed in to change notification settings - Fork 13
Replicating Hit Reacts
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
- If your project uses GAS then the server applies a gameplay cue that contains a location and normal and possibly a bone and calls
- Play hit react when landing from a significant height
-
ACharacter::OnLanded()event is net predicted and occurs on all net roles, and can callHitReact()
-
- Play hit react when running into a wall
-
ACharacter::MoveBlockedBy()event is net predicted and occurs on all net roles, and can callHitReact()but is not available to BP
-
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:


The gameplay cue was triggered via the PushPawn push ability.

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:
-
FHitReactInputParamsbone simulation properties -
FHitReactTrigger : public FHitReactInputParamsall impulse properties -
FHitReactTrigger_Linear : public FHitReactInputParamslinear impulse properties -
FHitReactTrigger_Angular : public FHitReactInputParamsangular impulse properties -
FHitReactTrigger_Radial : public FHitReactInputParamsradial impulse properties
These data types have an associated trigger function:
-
FHitReactTrigger➜UHitReact::HitReactTrigger() -
FHitReactTrigger_Linear➜UHitReact::HitReactTrigger_Linear() -
FHitReactTrigger_Angular➜UHitReact::HitReactTrigger_Angular() -
FHitReactTrigger_Radial➜UHitReact::HitReactTrigger_Radial()