通过遮罩功能可以丢弃剪辑中的一些动画数据,从而让剪辑仅动画化对象或角色的某些部分而不是整体。例如,如果有一个带有投掷动画的角色,现在希望能够将投掷动画与各种其他身体动作(如奔跑、蹲伏和跳跃)结合使用,则可以为投掷动画创建一个遮罩,使其局限于右臂、上半身和头部。然后,动画的这一部分可在基本奔跑或跳跃动画的上一层播放。
遮罩可应用于您的构建,使文件大小和内存更小。此外还可以提高处理速度,因为在运行时混合的动画数据更少。在某些情况下,导入遮罩可能对您不适用。在这种情况下,可使用 Animator Controller 的层设置在运行时应用遮罩。本页面与导入设置中的遮罩有关。
要将遮罩应用于导入的动画剪辑,请展开 Mask 标题以显示 Mask 选项。打开该菜单时,您将看到三个选项:Definition、Humanoid 和 Transform。
在此处可以指定是否要在 Inspector 中专门为此剪辑创建一次性遮罩,或者是否要使用项目中的现有遮罩资源。
如果希望仅为此剪辑创建一次性遮罩,请选择“Create From This Model”。
如果希望多个剪辑使用相同的遮罩,则应选择“Copy From Other Mask”并使用遮罩资源。这样即可对多个剪辑重复使用同一个遮罩定义。
选择 Copy From Other Mask 时,Humanoid 和 Transform 选项不可用,因为这些选项仅与在此剪辑的 Inspector 中创建一次性遮罩有关。
Humanoid 选项可让您选择或取消选择人体图的身体部位,从而快速定义遮罩。如果已将动画标记为人形并具有有效的 Avatar,则可以使用此类选项。
使用此选项可根据各个骨骼或动画的移动部件来指定遮罩。这样可以更精确地控制确切的遮罩定义,还可以将遮罩应用于非人形动画剪辑。
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.