Change or add an animation¶
Every character clip sits in a slot of an animation set. No Blueprint has a field for a clip, so you change one by pointing its slot at yours.
The animation set¶
A set is a Data Asset of the class PDA_AnimSet, in Content/ZombieSurvival/DataAssets/Animation/.
Two ship next to the class, DA_AnimSet_Survivor_Base and DA_AnimSet_Zombie_Base. There is no
Childs/ folder, because the Asset Manager scans that folder.
| Field | What it does |
|---|---|
CharacterType |
Which character it is for: Anim.Character.Survivor or Anim.Character.Zombie. |
Priority, bIsDemo |
Whether it is a demonstration set, and its order among them (higher first, then by name). |
Slots |
For each slot tag (under Anim. or Gesture.), an S_AnimSlot: Clip (a soft reference), PlayRate, BlendIn, BlendOut, bLoop, ReferenceSpeed and WarpWindows. ReferenceSpeed is the ground speed a gait was made for, 0 to play it as it is. |
FamilyFallbacks |
For a parent tag, the slot that plays for any slot under it with no clip. Gesture falls back on Gesture.Use, and Anim.Survivor.Melee on the first unarmed attack. |
Steps¶
Change a clip¶
- Open the base set and find the slot.
- Point the slot at your clip. The clip must be on
Meshes/Characters/SKEL_Mannequin.
Add a gesture¶
- Declare its tag under
Gesture.in Edit > Project Settings > Gameplay Tags. - Add the slot to
DA_AnimSet_Survivor_Base. - Name it in
Gestureof the action (PDA_ActionDef).
Until the slot has a clip, the action plays the family fallback.
Add a set¶
- Make another instance of
PDA_AnimSetitself, not of a child class. - Put it in
DataAssets/Animation/orDemoContent/Epic/DataAssets/. These are the two folders of thePDA_AnimSet_Centry of the Asset Manager (Edit > Project Settings > Asset Manager, orConfig/DefaultGame.ini).
Nothing references a set. At start, the game finds every set and loads it with its clips.
How the game picks a clip¶
For a slot, BFL_ZSAnim.ResolveSlot takes, in order:
- the first demonstration set of the character type that has the slot with its clip loaded;
- the base set;
- the base set's fallback for the closest parent tag.
The demonstration set, DemoContent/Epic/DataAssets/DA_AnimSet_Survivor_Demo (priority 10), plays
Lyra's rifle reload, which has its own licence, on Gesture.Reload.Magazine, in
place of the base set's pistol reload. Nothing references it: delete DemoContent/Epic/ and the base
set plays.
A slot picked by context¶
A PDA_AnimSelectTable gives a slot, which is then resolved as above. BFL_ZSAnim.SelectSlot takes
the first row of Rows whose height and speed bounds hold the context (-1 means no bound) and whose
PoseCategory is empty or the held weapon's. With no row that fits, the unarmed combo plays.
DataAssets/Animation/DA_AnimSelect_Melee, read through BP_Survivor.MeleeSelectTable, picks the
melee attack slot by pose category:
| Pose category | Slot | Clip |
|---|---|---|
| Two-handed blunt: the two bats, the nail board, the axe and the sledgehammer | Anim.Survivor.Melee.Attack.Blunt2H |
A_Survivor_Attack_Blunt2H, a swing from over the right shoulder |
| Knife | Anim.Survivor.Melee.Attack.Knife |
A_Survivor_Attack_Knife, a stab |
One-handed blunt: the crowbar, or any Weapon.Pose.Blunt1H weapon |
Anim.Survivor.Melee.Attack.Blunt1H |
A_Survivor_Attack_Blunt1H, a blow from above |
Each clip lasts 1 s and lands its blow 0.2 s in. The hit itself is resolved after
AttackImpactDelay, a Class Default of BP_Survivor, which is
0.18 s.
The generic gesture¶
Gesture.Use plays A_Survivor_Use, 1.2 s of both hands working in front at waist height. Every
gesture without a clip of its own falls back on it through FamilyFallbacks: crafting, wearing,
sewing, filling a magazine, mounting an attachment.
Weapon poses¶
PoseCategory on a PDA_WeaponDef (a Weapon.Pose.* tag) picks the animation layer linked while
the weapon is held. BP_Survivor.WeaponLayers maps each category to an ABP_Weapon_<Category>, a
child of Blueprints/Player/ABP_Weapon_Base that plays its PoseSlot
(Anim.Survivor.Pose.Aim.<Category>). ABP_Survivor blends that pose over the upper body from
spine_01 while the survivor aims.
A new category needs a tag, a child of ABP_Weapon_Base with its PoseSlot, an entry in
WeaponLayers, and the slot in the base set.
Zombie gaits¶
LocomotionSlot on a PDA_ZombieDef names the gait of an archetype: Anim.Zombie.Locomotion.Slow,
.Brisk or .Runner. ABP_Zombie plays it at the zombie's speed divided by the slot's
ReferenceSpeed, which is 100, 210 and 380 uu/s on the shipped gaits.
Zombie attacks and idle¶
Three clips fill three slots of DA_AnimSet_Zombie_Base:
Anim.Zombie.Attack.Claw:A_Zombie_Attack_Claw, 1 s, the strike at 0.23 s;Anim.Zombie.Attack.Bite:A_Zombie_Attack_Bite, 1 s, the strike at 0.23 s;Anim.Zombie.Idle:A_Zombie_Idle, a hunched loop of 2 s.
When a blow lands, BP_Zombie.PlayAttackAnim plays the bite or the claw to match the hit, from the
Settings AttackClawSlot and AttackBiteSlot. Every machine sees it. A crawler or a zombie on the
ground plays none. To change an attack, point its slot at your own clip.
Gestures that move the character¶
A clip with root motion moves the character when a slot plays it. Both animation Blueprints use
Root Motion from Montages Only. The locomotion clips and the three unarmed attack clips keep
Force Root Lock, and the attacks also have Enable Root Motion off, so a blow never moves the
body. The three unarmed attacks are two punches, and a high kick that BP_Survivor.AttackSlots
leaves out of the cycle.
A slot's WarpWindows bend the clip towards a target through the MotionWarping component of
BP_Survivor. Each window is an S_WarpWindow: StartTime, EndTime, TargetName,
bWarpTranslation and bWarpRotation. Set the target by name on the component
(AddOrUpdateWarpTargetFromLocationAndRotation) before the slot plays. BFL_ZSAnim.PlayAnimSlot
then adds each window to the montage as a skew warp. Without the component, a slot plays without its
windows.
No shipped slot has a warp window yet: fences and windows are still crossed along an arc. Motion Warping is a Beta plugin in Unreal Engine 5.8. The component and these windows are all that use it.
Test it¶
- Change a clip in
DA_AnimSet_Survivor_Base, for example the slot of a gesture, and save. - Open
Content/ZombieSurvival/Maps/L_Worldand press Play. - Run the action that plays that slot (open a door, reload, read). Your clip plays.
If it does not work¶
- The old clip still plays: a demonstration set has the same slot with its clip loaded, and it comes
before the base set. Change the clip in that set, as for
Gesture.Reload.MagazineinDA_AnimSet_Survivor_Demo.