Version: 2019.1
动画剪辑上的循环优化
事件

曲线

您可以在 Animation 选项卡中将动画曲线附加到导入的动画剪辑。

可以使用这些曲线将其他动画数据添加到导入的剪辑。可以根据animator的状态,使用该数据来动画化其他项的时序。例如,在冰冷环境的游戏中,可以使用额外的动画曲线来控制粒子系统的发射速率,以显示玩家在冷空气中的冷凝呼吸。

要向导入的动画添加曲线,请展开 Animation 选项卡底部的 Curves 部分,然后单击加号图标以向当前动画剪辑添加新曲线:

Animation 选项卡上展开的 Curves 部分
Animation 选项卡上展开的 Curves 部分

如果导入的动画文件被拆分为多个动画剪辑,则每个剪辑都可以拥有自己的自定义曲线。

导入的动画剪辑上的曲线
导入的动画剪辑上的曲线

曲线的 X 轴表示_标准化时间_,范围始终在 0.0 和 1.0 之间(无论持续时间如何,均分别对应于动画剪辑的开头和结尾)。

Unity 曲线编辑器
Unity 曲线编辑器

A Wrapping mode

B Curve Presets

Double-clicking an animation curve brings up the standard Unity curve editor which you can use to add keys to the curve. Keys are points along the curve’s timeline where it has a value explicitly set by the animator rather than just using an interpolated value. Keys are very useful for marking important points along the timeline of the animation. For example, with a walking animation, you might use keys to mark the points where the left foot is on the ground, then both feet on the ground, right foot on the ground, and so on. Once the keys are set up, you can move conveniently between key frames by pressing the Previous Key Frame and Next Key Frame buttons. This moves the vertical red line and showa the normalized time at the keyframe. The value you enter in the text box drives the value of the curve at that time.

动画曲线和 Animator Controller 参数

如果一条曲线的名称与 Animator Controller 中的某个参数同名,则该参数的值将取自这条曲线在时间轴中每个点的值。例如,如果从脚本调用 GetFloat,则返回的值等于进行调用时的曲线值。请注意,在任何给定的时间点,可能有多个动画剪辑试图设置同一控制器中的同一参数。在这种情况下,Unity 会混合多个动画剪辑中的曲线值。如果动画没有特定参数对应的曲线,则 Unity 将与该参数的默认值混合。


  • 2018–04–25 页面已修订并只进行了有限的编辑审查
动画剪辑上的循环优化
事件