在Unity中,动画有层的概念,可以多层混合,实现混合动画,如边走边瞄准,蹲着瞄准,趴着瞄准,跳起来瞄准。
UE4中,理念相近。
以下是实现的方式:
- 针对需要混合到别的动画中的那个动画(例如叫“动画A”),建立一个Montage。
- 在该Montage中添加一个Slot,如命名为:UpperBody。
- 在 ABP中,对原来的状态机进行缓存,使用 new save cach pose节点。
- 在ABP中,使用LayerBlendPerBone对缓存的原动画,以及“缓存+Slot处理”的动画进行混合。并且在LayerBlendPerBone中设置Branch Filters为相应的骨骼,如spine_01(注意Blend Depth设置为大于零的数值)。
- 在ABP的EventGraph中,在需要执行瞄准动画的时候,调用MontagePlay节点。
以下是ABP中的两张关键图:
注:
- 在 Layered blend per bone 节点中,如果不勾选’Mesh Space Rotation Blend’ ,可能导致骨骼移动时,旋转的偏差。
- 在 Layered blend per bone 节点中,bone depth用于设置骨骼被动画影响的程度,如:For example, if your branch filter is a spine bone but you don’t want the left arm (a child of the spine) to be influenced, you could add another Branch Filter for the left arm and set it’s Blend Depth to -1。此点详见:此处
UE4 如何实现分层的混合动画


