Unity 使用__动画层__来管理不同身体部位的复杂状态机。相应的示例为,您有一个用于行走/跳跃的下身层,还有一个用于投掷物体/射击的上身层。
您可以从 Animator Controller 左上角的 __Layers 小部件__管理动画层。
单击窗口右侧的齿轮可显示该层的设置。
On each layer, you can specify the mask and the Blending type. The mask specifies the body parts on which to apply the animation. The Blending type specifies how the animation is applied.
Add a new layer by pressing the + above the widget.
The Mask property is there to specify the mask used on this layer. For example if you wanted to play a throwing animation on just the upper body of your model, while having your character also able to walk, run or stand still at the same time, you would use a mask on the layer which plays the throwing animation where the upper body sections are defined, like this:
An ‘M’ symbol in the Layers sidebar indicates that the layer has a mask applied.
有时,能够在不同层中复用同一状态机是很有用的。例如,如果想要模拟“受伤”行为,并生成“受伤”状态下的行走/奔跑/跳跃动画,而不是“健康”状态下的动画,您可以单击其中一个层上的 Sync 复选框,然后选择要同步的层。随后状态机的结构便会相同,但状态使用的实际动画剪辑不同。
这意味着同步的层根本没有自己的状态机定义,而是同步层状态机的一个实例。在同步层视图中对状态机的布局或结构所做的任何更改(例如,添加/删除状态或过渡)都是针对同步层的源进行的。同步层的唯一独特更改是每个状态内使用的选定动画。
通过 Timing 复选框,Animator 可调整同步层中每个动画所需的时间(由权重决定)。如果取消选中 Timing,则会调整同步层上的动画。该调整会将动画的长度拉伸到与原始层上的一致。如果选中该选项,则动画长度将在两个动画之间平衡(基于权重)。在两种情况下(选中和不选中),Animator 都将调整动画的长度。如果不选中,则原始层将是唯一母版。如果选中,则采用折中方案。
An ‘S’ symbol in the Layers sidebar indicates that the layer is a synced layer.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.