Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
AnimationState.AddMixingTransform 添加混合变换
# [AnimationState](AnimationState.html).AddMixingTransform 添加混合变换 function *AddMixingTransform* (*mix* : [Transform](../Transform/Transform.html), *recursive* : bool = true) : void *Description* 描述 Adds a transform which should be animated. This allows you to reduce the number of animations you have to create. 加入一个动画变换。这使你减少创建动画的工作量。 For example you might have a handwaving animation. You might want to play the hand waving animation on a idle character or on a walking character. Either you have to create 2 hand waving animations one for idle, one for walking. By using mixing the hand waving animation will have full control of the shoulder. But the lower body will not be affected by it, and continue playing the idle or walk animation. Thus you only need one hand waving animation. 例如你可能有一个挥手(hand-waving)动画. 你可能需要让一个空闲站立(idle)角色或者一个走动(walking)角色 来挥手. 如果没有动画混合你可能需要制作两个挥手 hand-waving 动画 : 一个给 idle, 一个给 walking. 可是, 如果你将挥手(hand-waving)动画作为一个 mixing transform 添加到 shoulder transform,挥手动画将只控制肩膀. 身体余下部位不受其影响, 下半身会继续播放 idle 或者 walk 动画. 因而你只需要一个挥手(hand-waving)动画. If recursive is true all children of the mix transform will also be animated. If you don't call AddMixingTransform, all animation curves will be used. 如果循环模式为 true 所有混合 transform 的子项将动画处理。如果你不调用 AddMixingTransform,所有的动画曲线将被使用. * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public Transform shoulder; public void Awake() { animation["wave_hand"].AddMixingTransform(shoulder); } } ``` ``` // Adds a mixing transform using a path instead // 不用路径增加一个混合transform var shoulder : Transform ; animation["wave_hand"].AddMixingTransform(shoulder); ``` 另一个例子: * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { void Start() { Transform mixTransform = transform.Find("root/upper_body/left_shoulder"); animation["wave_hand"].AddMixingTransform(mixTransform); } } ``` ``` function Start () { // Adds a mixing transform using a path // 用路径增加一个混合transform var mixTransform : Transform = transform.Find("root/upper_body/left_shoulder"); animation["wave_hand"].AddMixingTransform(mixTransform); } ```
da
2022年5月13日 22:21
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码