找回密碼
 注冊帳號

掃一掃,訪問微社區

animationstate.addmixingtransform 添加混合變換

2014-12-31 05:10| 發布者: 楊炎| 查看: 2954| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: animationstate.addmixingtransform 添加混合變換functionaddmixingtransform(mix:transform,recursive: bool = true) : voiddescription描述adds a transform which should be animated. this allows you to reduce ...

animationstate.addmixingtransform 添加混合變換

functionaddmixingtransform(mix:transform,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{

publictransformshoulder;

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() {

transformmixtransform = 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);

}

相關閱讀

文章點評
相關文章
女校游泳队彩金