Unity 有一个丰富而复杂的动画系统(有时称为“Mecanim”)。该系统具有以下功能:
Unity 的动画系统基于动画剪辑的概念;动画剪辑包含某些对象应如何随时间改变其位置、旋转或其他属性的相关信息。每个剪辑可视为单个线性录制。来自外部的动画剪辑由美术师或动画师使用第三方工具(例如 Autodesk® 3ds Max® 或 Autodesk® Maya®)创建而成,或者来自动作捕捉工作室或其他来源。
然后,动画剪辑将编入称为 Animator Controller 的一个类似于流程图的结构化系统中。Animator Controller 充当“状态机”,负责跟踪当前应该播放哪个剪辑以及动画应该何时改变或混合在一起。
一个非常简单的 Animator Controller 可能只包含一个或两个剪辑,例如,使用此剪辑来控制能量块旋转和弹跳,或设置正确时间开门和关门的动画。一个更高级的 Animator Controller 可包含用于主角所有动作的几十段人形动画,并可能同时在多个剪辑之间进行混合,从而当玩家在场景中移动时提供流畅的动作。
Unity 的动画系统还具有用于处理人形角色的许多特殊功能。这些功能可让人形动画从任何来源(例如:动作捕捉、Asset Store 或某个其他第三方动画库)重定向到您的角色模型中,并可调整肌肉定义。这些特殊功能由 Unity 的替身系统启用;在此系统中,人形角色会被映射到一种通用的内部格式中。
所有这些部分(动画剪辑、Animator Controller 和 Avatar)都通过 Animator 组件一起附加到某个游戏对象上。该组件引用了Animator Controller,并(在必需时)引用此模型的 Avatar。Animator Controller又进一步包含所使用的动画剪辑的引用。
上图显示了以下内容:
Unity 动画系统中有很多的概念和术语。如果在任何时间需要了解术语的含义,请转至动画术语表。
While Mecanim is recommended for use in most situations, Unity includes its legacy animation system which existed before Unity 4. You may need to use the legacy animation system when working with older content created before Unity 4. For information on the Legacy animation system, see this section
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.