2.4 动画蓝图与动混:Blend Space + Montage + Root Motion
核心结论
角色"动得对"靠 Locomotion(移动动画的八方向混合),"动得好看"靠 Montage(技能/受击的全身动画),"动得到位"靠 Root Motion(位移精确)。三者的组合方式是动画层的标准结构。动画蓝图的官方指南(https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/animation-blueprints-in-unreal-31d3)是骨架,本文讲怎么在中小项目里落地。
分层结构(我的标准 ABP)
AnimBP
+-- Update Animation(每帧)
| +-- 从 CMC/ASC 拉 Speed、bInAir、bAttacking 等状态(只读)
| +-- 更新各个 Blend Space 的参数
+-- Locomotion 状态机
| +-- Idle / Run(Blend Space,按速度与方向混合)
| +-- Jump Start / Fall / Land(跳跃三段)
| +-- Slide / Sprint(高级移动)
+-- Layers:上半身层(拿武器/技能播放)与 Full Body Slot
规则:ABP 只做"状态驱动的混合",不放技能逻辑。技能用 PlaySlotAnimation 或 Montage 在 GA 里播(见 0201)。
Blend Space:八方向移动的标准做法
按官方 Blend Space 指南(https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/blend-spaces-in-unreal-engine-e1b9)配一张"速度 X 方向"的二维混合:
- 坐标轴:
Speed(0~600)与Direction(-180~180)。 - 规则:动画面向正前方制作(原地走/跑)。
- 规则比动画重要:方向用"加速度方向"而不是"速度方向",转身会自然很多。
我的小技巧:慢速用 Walk 动画,中速 Run,高速把 StrideWarping 打开(UE5 的步幅矫正),同一套动画覆盖 250~700 速度。
Montage:技能/受击/死亡的载体
按官方 Montage 文档(https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/animation-montage-in-unreal-en-a6c5)的规范:
| 用途 | Section 设计 | Root Motion |
|---|---|---|
| 普攻三连 | Default/Combo2/Combo3 | 按节奏小位移 |
| 受击 | 前后左右四方向分支 | 无 |
| 死亡 | Death(不循环) | 无 |
| 大招 | Antic->Cast->Hit->Recover | 类似位移 |
关键纪律:每个观赏性 Montage 都预留一个 Anim Notify(AnimNotify_PlayVFX/Sound 的自定义 Notify),特效/音效/伤害判定全都挂在 Notify 上——这样美术调动画时间时,反馈自动跟着。
连招系统:NextCombo 的接力
普攻 Montage 里:
... Section1 -> AnimNotify_EnableCombo(开窗口)
... Section2 <- 收到"下一次输入"则跳 Section2
... 否则播完回 Locomotion
输入缓冲:玩家在窗口期按键就缓存,满窗口期立即接下一刀(输入系统那本书详细讲过缓冲设计)。
Root Motion 的取舍
| 场景 | 用 RM? | 原因 |
|---|---|---|
| 精确的冲刺/处决 | 用 | 位移必须与动画严格对齐 |
| 普通移动 | 不用 | CMC 管(网络复制成本低) |
| 击退/击飞 | 用 | 受击方向精确 |
| 大范围 AOE 技能 | 不用 | 用数据驱动位置 |
网络注意:Root Motion 默认会被复制,但需要客户端预测配合;中小项目如果不联机,无脑开 RM 也没事。
Motion Warping:让动画"够到"目标
UE5 的 Motion Warping(https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/motion-warping-in-unreal-engin-2fed)解决"处决动画固定距离"的问题:动画播放同时,把骨骼根点Warp 到目标位置。
我的用法:处决/背刺/爬墙翻越——目标距离不固定但动画固定时,Warp 是唯一体面的解。注意 Warp 的位移别开太大(>2m 会明显"扭")。
常见坑与解法
坑 1:ABP 里写技能逻辑
后果:动画与玩法双向耦合,任何改动两边都要改。
解法:状态从 Gameplay 读(只读),逻辑在 GA。ABP 是"观众",不是"演员"。
坑 2:Montage 播放与伤害判定不同步
解法:伤害判定挂在 AnimNotify 的 C++/蓝图中,与动画帧严格对齐。
坑 3:跳跃动画"脚滑"
原因:Locomotion 的混合规则用了速度方向而角色在加速。
解法:用 bUseAccelerationDirection 或规则改成 Facing 方向混合。
相关节点速查
- ABP 指南:https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/animation-blueprints-in-unreal-31d3
- 移动混合:https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/blend-spaces-in-unreal-engine-e1b9 / https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/locomotion-in-unreal-engine-86c2
- 技能动画:https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/animation-montage-in-unreal-en-a6c5
- 位移扭转:https://www.wanxiangyundang.top/read/unreal-engine-5-8-docs/motion-warping-in-unreal-engin-2fed
心得:动画层的投资回报是所有系统里最高的——同一套玩法,换一套好的 ABP,打击感能涨 30%。而做法其实朴素:状态机清晰、通知驱动反馈、RM 精确位移、Warp 修正距离。没有黑魔法,全是基本功。
