Animation Integration

Documentation Unreal Engine Player Combat Animation

Animation integration keeps combat timing on the animation: a montage window holds a gameplay tag, an item brings its own animation layer, a frame asks for a footstep, and the pose holds on a hit.


Set it up

2 minutes
  1. 1

    Put a state tag window on the dodge

    On the demo player, open AM_UPC_DodgeBack (it already carries this window; on a dodge montage of your own, add one). Right-click a notify track, Add Notify State, UPC State Tag Window. Drag it across the frames the dodge should pass through blows, and put UPC.State.Intangible in Tags.
    AM_UPC_DodgeBack
    ▾State Tags
    Tags 
  2. 2

    Map the tag to a bool

    The same tag can drive your Animation Blueprint. In ABP_UPC_MannequinBase the parent is already UPC Anim Instance Base; in your own, open Class Settings and set Parent Class to it. Add a bool, IsIntangible, and in Class Defaults add a Gameplay Tag Property Map row: the tag in Tag to Map, the bool in Property to Edit.
    Details
    ABP_MyHero
    UPC
    Gameplay Tags
    Gameplay Tag Property Map
    Property Mappings
    1 Array element
    Index [ 0 ]
    Tag to Map
    UPC.State.Intangible
    Property to Edit
    IsIntangible
    Each row keeps one bool variable in step with one tag on the character, whatever put the tag there.
  3. 3

    Press Play and dodge through a swing

    Dodge through an enemy's swing: a melee trace passes through UPC.State.Intangible, so a swing crossing those frames lands nothing. Your IsIntangible bool is true for the window and false after it, for a pose or an effect to read.
The tags go on the character's ability system; a pawn without one holds nothing.

Tell the plugin which mesh does what

Add these names to a skeletal mesh's Component Tags (plain names, separate from gameplay tags). A tag counts when it equals the name or starts with it and a dot: UPC.Attachment.Body counts for UPC.Attachment.
TagMarks a mesh that
UPC.MontagePlays the character's montages. The main mesh plays them untagged; tag it so item layers fall back to it, and tag each extra mesh that should follow.
UPC.AnimLayerTakes the drawn item's animation layer. With none tagged, the montage meshes take it.
UPC.AttachmentHolds drawn items. The full tag tells several apart.
A one-mesh character needs UPC.Montage and UPC.Attachment.Body; the character base's UPC Anim Manager reads them as the character spawns.
Details
AnimManagerComponent
UPC
Mesh Registry
Montage Mesh Tag Prefix
UPC.Montage
Anim Layer Mesh Tag Prefix
UPC.AnimLayer
Attachment Mesh Tag Prefix
UPC.Attachment
Default Attachment Tag
None
Hit Stop
Hit Stop Enabled
Anim
Debug
Debug Overlay Anim
Designer Tools
Preview Mesh Discovery
Preview Mesh Discovery lists which meshes the tags would register, and in which roles, without registering anything.

Give an item its own animation layer

Three assets meet. An animation layer interface names each layer (say, a walk cycle). The character's Animation Blueprint has a Linked Anim Layer node for that layer, where the walk plays. An item's Animation Blueprint implements the layer with the item's own animation, and the item names it as its Anim Layer Class (Items).
In the demo, ALI_UPC_ItemAnimLayers (Core/Animation) declares the layer, ABP_UPC_MannequinBase has the node for it, ABP_UPC_SwordAnimLayer implements it with the sword's walk, and Item_UPC_Sword names that Blueprint. Drawing the sword links its walk into the node; putting it away unlinks it. A custom character adds the Linked Anim Layer nodes to its own Animation Blueprint, and a custom weapon duplicates ABP_UPC_SwordAnimLayer (it works on the demo mannequin or a child of ABP_UPC_MannequinBase) and sets the copy on its item.
Only the item driving combat links a layer, so a shield beside a sword animates through the sword's layer (Equipment).

Hold a tag for part of an animation

A UPC State Tag Window holds its Tags on the character while it runs. An interrupted montage drops its tags, so a canceled dodge loses its i-frames. These tags are ready to hold; a tag of your own works the same way:
TagHold it overRead by
UPC.State.IntangibleA dodge's i-framesA melee trace, which passes through
UPC.State.HyperArmorA heavy swing light hits must not stopA Scale Damage response (lets part of a hit's damage through; Hit Reactions)
UPC.State.Parrying, UPC.State.BlockingA parry's active frames, a raised guardA defense rule or a reaction you gate on it
UPC.State.Staggered, UPC.State.RecoveringA stagger, the recovery after an actionTransitions you gate on them

Fire a one-off signal from a frame

For a moment with no window, such as a prop spawning or an interaction committing, add Notify, UPC Gameplay Event at the frame and set Event Tag. A gameplay ability's Wait Gameplay Event task, or a Wait Gameplay Event to Actor node in any Blueprint, pointed at the character, hears it once. The character is instigator and target, and the animation is the Optional Object.

Hold the pose on a hit

A hit stop holds the picture as a blow lands, while the montage, its windows and the movement run on. Each mesh that holds needs a UPC Hit Stop node after the montage slot, followed by an Inertialization node:
ABP_MyHero · AnimGraph
Slot 'DefaultSlot'
Group 'DefaultGroup'
Source
UPC Hit Stop
Source
Inertialization
Source
Output Pose
Result
SettingDoes
Release Blend TimeSeconds the held pose takes to blend back into the live one (0.1); 0 snaps back. A longer hold adds half the hold to the blend, up to this value again (at 0.1, a 0.3 s hold blends back in 0.2 s). Max Hit Stop Seconds (0.3 s, Project Settings > Plugins > Universal Player Combat) caps the hold and the blend back, each separately.
Hold PlacementKeeps the held body where it stood while root motion or a glide moves the character; it catches up on release. Turn it off on a mesh attached to the camera, such as first-person arms.
A damage config's UPC Hit Stop hit effect asks for the hold (Damage and Hit Effects).

Ask the character for its own effect

Two notifies ask the character for an effect; each character answers with its own sounds and particles, so a barefoot rogue and a plated knight differ.
NotifyUse it for
UPC Anim EffectOne frame: a footstep, a landing, a grunt.
UPC Anim Effect WindowA stretch from its first frame to its last: a weapon trail, a charge glow.
Set Effect Tags, such as UPC.AnimEffect.Footstep.Left, and Socket Name, where on the body; None plays at the mesh's position.
To answer them, make an Anim Effect Bank with a row per Effect Tag holding its Sounds and Particles, and set it as Bank on the character's UPC Anim Effects component (AnimEffectComponent on the character base). A request plays the row whose tag matches it most closely: in a bank with a Footstep row and a Footstep.Left row, a left step plays Footstep.Left and a right step plays Footstep.
Content Browser
▸ Content
Details
AnimEffectBank_MyHero
Anim Effects
Rows
1 Array element
UPC.AnimEffect.Footstep
Effect Tag
UPC.AnimEffect.Footstep
Sounds
1 Array element
Index [ 0 ]
SC_UPC_Footsteps
Particles
0 Array elements
Attach to Socket
Forward Axis
1.0
0.0
0.0
Volume Multiplier
1
Pitch Multiplier
1
Particle Scale
1
Surface Set
None
Each row takes its Effect Tag as its title. Surface Set, beside the rows, lets a row answer only on one kind of ground.
Row settingDoes
Attach to SocketFollow the socket. Off leaves the effect where the frame fired, as dust on the ground wants.
Forward AxisThe socket axis the particles face: X its forward, Y for a bone whose Y points out of the body, such as the mannequin spine.
Volume Multiplier, Pitch Multiplier, Particle ScaleScale the sounds and particles; 1 plays them as authored.
An item's Swing Trail fragment draws its ribbon while a window carrying UPC.AnimEffect.Weapon.Trail runs (Items).
The animation and montage editors play a clip's effects from Preview Bank (Project Settings > Plugins > Universal Player Combat Editor, the demo bank to start) and name the bank in the viewport's corner.

One montage on several meshes

An extra mesh tagged UPC.Montage (first-person arms next to the body, say) plays the character's montages but only animates; each notify the plugin ships does its work once, on the body. Equipment covers which mesh holds the items.

Debug it

UPC.Debug.Anim 1          // Each character's montage mesh, layer mesh and hit stop time
UPC.Debug.AnimEffects 1   // Each character's last effect requests and what answered them
Log LogUPCAnim Verbose    // The same answers in the log
ShowDebug AbilitySystem   // The tags each character holds
Debug Overlay Anim on an Anim Manager shows the first overlay for one character. Test effects on a client or a listen server; a dedicated server plays none.
AdvancedThe mesh registry
  • Register Mesh adds a mesh during play, such as a mount or an outfit part, with its roles ticked by hand. Its Attachment Tag lets items hang on it; None keeps the slot its own UPC.Attachment component tag gives. Include in Hit Stop off keeps it moving through holds.
  • Release Hit Stop ends a hold, for a death that plays no montage. Unregister Mesh takes a mesh out; Rediscover Meshes scans the component tags again and keeps meshes registered by hand.
  • With neither UPC.AnimLayer nor UPC.Montage on any mesh, a layer links nowhere. A character drawing items needs an Anim Manager; without one, a draw warns once.
  • When the driving item changes, the new layer links before the old one unlinks, so a layer both share stays on.
AdvancedWindows, bools and events
  • A window of no length holds nothing, and two windows holding one tag keep it until the second closes. A window restarted without an end, as a jump back a section does, releases its first record; tags come off the ability system they went onto.
  • A mapped bool follows a tag from a window and a tag from a gameplay effect alike. UPC Anim Instance Base finds the character's ability system itself, one appearing later on a Player State included; Initialize with Ability System points it elsewhere. Get Owned Tags returns this frame's tags, safe in a thread-safe animation function.
  • A listener that starts waiting after a UPC Gameplay Event frame hears nothing.
  • An animation cut short inside a UPC Anim Effect Window can skip its close, so a handler also stops anything costly at teardown.
AdvancedEffect tags, surfaces, layers and Blueprint answers
  • Tags. The plugin's effect tags sit under UPC.AnimEffect: Footstep (Left, Right, Land), Land, Jump, Roll, Slide, Foley, Vocal, Whoosh, Weapon (Draw, Sheathe, Hit, Trail, Glow) and Blood.
  • Surfaces. With a Surface Set on the bank, a footstep on a material mapped to Stone plays a Footstep.Stone row before Footstep, while a deeper plain row such as Footstep.Left still wins. Add each surface row's tag to the project's tag list. The component traces the ground only for an effect that has surface rows, on its Surface Trace Channel (Visibility) up to Surface Trace Distance (50 cm) below the socket.
  • Layers. Add Bank layers a bank at a Priority, such as wet ground while it rains; the highest wins, the newest on a tie, and a layer needs only the rows it changes. Remove Bank takes it off; Set Bank replaces the character's own.
  • Blueprint answers. Implement the UPC Anim Effect Handler interface (Handle Anim Effect, Begin and End) on the character or any component. Every handler is asked.
  • Per skeleton. Preview Banks By Skeleton gives one skeleton's clips their own preview bank.
AdvancedFootsteps on a whole folder of animations
The UPC Footsteps animation modifier, applied from an animation's Animation Data Modifiers window, writes a UPC Anim Effect where each foot lands: Footstep.Left at foot_l, Footstep.Right at foot_r, on a Footsteps track each apply rebuilds. Ground Tolerance (3 cm) is how far above its lowest point a foot counts as planted, Lift Height (5 cm) how high it rises before the next landing counts, and Notifies to Remove clears older footstep notifies.
For a folder, run UPC.AnimEffects.PlantFootsteps /Game/MyCharacter/Animations save; without save the animations wait for a Save All. A turn in place can miss a step, and a jump or fall clip can gain a false one.
The demo
  • BP_UPC_Character tags its mesh UPC.Montage and UPC.Attachment.Body; its ABP_UPC_MannequinBase is a UPC Anim Instance Base.
  • The item layers are children of ABP_UPC_ItemAnimLayersBase, which maps UPC.State.Blocking to a bool: ABP_UPC_SwordAnimLayer (sword and shield), ABP_UPC_TwoHandedAnimLayer, ABP_UPC_UnarmedAnimLayers.
  • AM_UPC_DodgeBack holds Intangible, AM_UPC_Sword_Parry Parrying and AM_UPC_Unarmed_Combo HyperArmor. The chest, door and pickup montages send UPC.Event.Interaction.Commit.
  • The player's bank is AnimEffectBank_UPC_Default.
MultiplayerWhat runs where
  • Windows add their tags on each machine playing the montage; nothing replicates. The server's damage checks read its own window.
  • On a dedicated server a window runs only while the mesh ticks its pose, as a character's mesh does by default (Visibility Based Anim Tick Option at Always Tick Pose). Only Tick Pose when Rendered stops it, a root motion montage aside, and the Anim Manager warns once. Keep Trigger on Dedicated Server ticked on each notify.
  • Effects and gameplay events fire on each machine playing the animation (effects never on a dedicated server). Item layers link on each machine as the drawn item arrives. Hit stop: Damage and Hit Effects.
C++C++
  • UUPCAnimManagerComponent holds the mesh registry, links item layers (LinkAnimationLayer, counted per class) and runs hit stop (HoldPose); UUPCAnimInstanceBase carries the tag to bool map.
  • A gameplay notify of your own returns early when UPCMontageWindow::IsGameplayMesh(MeshComp) answers false, as the plugin's do: only the mesh the ability system plays montages on counts, or every mesh on a character with no Anim Manager. MirrorMontagePlayAt plays a montage on the extra meshes and returns a ticket for MirrorMontageStopFor.
  • IUPCAnimEffectHandler receives every effect request; UUPCAnimEffectBankStatics plays a bank row without the component.
  • FUPCAnimNode_HitStop runs UPC Hit Stop; its editor node sits in the uncooked-only UPCAnimGraph module, which a packaged game never loads.
AdvancedTroubleshooting
Warning or symptomFix
UPC.Debug.AnimEffects lists no requestPut the notify on a montage the character plays.
Nothing on this character answers anim effectsAdd a UPC Anim Effects component or a handler.
A request reads nobody answeredGive the bank a row at or above the tag.
...a notify with no Effect TagsSet its Effect Tags.
...takes anim layers but runs no Animation BlueprintGive the mesh one, or take UPC.AnimLayer off it.
...more than one mesh tagged ...Give each attachment mesh its own tag.
Hit stop on ... shows nothingAdd the UPC Hit Stop and Inertialization nodes, or register a mesh copying another's pose with Include in Hit Stop off.
...sending ... but has no Ability System ComponentAdd one, or take the UPC Gameplay Event off.
Montage mesh ... ticks its pose only when renderedSee What runs where.