【文章內(nèi)容簡介】
al parameter(任意參數(shù)) to if you like).動畫混合Animation Mixing動畫混合可以讓你縮減你必須為游戲制作的動畫片斷數(shù)量 ,方法是制作只對身體某個部分起作用的動畫. 這意味著這些動畫可以和其他動畫合并起來一起使用.如果你想給一個動畫添加 animation mixing transform to an animation by calling AddMixingTransform() on the given AnimationState.混合范例Mixing Example例如你可能有一個揮手(handwaving)動畫. 你可能需要讓一個空閑站立(idle)角色或者一個走動(walking)角色 來揮手. 如果沒有動畫混合你可能需要制作兩個揮手handwaving動畫 : 一個給 idle, 一個給walking. 可是, 如果你將揮手(handwaving)動畫作為一個mixing transform 添加到shoulder transform,揮手動畫將只控制肩膀. 身體余下部位不受其影響, 下半身會繼續(xù)播放 idle 或者 walk 動畫. 因而你只需要一個揮手(handwaving)動畫./// Adds a mixing transform using a Transform variablevar shoulder : Transform。animation[wave_hand].AddMixingTransform(shoulder)。Another example using a path.function Start () { // Adds a mixing transform using a path instead var mixTransform : Transform = (root/upper_body/left_shoulder)。 animation[wave_h和].AddMixingTransform(mixTransform)。}附加動畫 Additive Animations附加動畫和動畫混合可以讓你縮減為游戲制作的動畫片斷的數(shù)量,并且對面部動畫(facial animations)來說非常重要.讓我們來看看如果創(chuàng)建一個在跑和轉(zhuǎn)身時身體可以自動傾斜的角色.你已經(jīng)制作好了一個 walk 和 run循環(huán), 現(xiàn)在你還要制作一個走動左傾( walkleanleft), 走動右傾(walkleanright), 跑左傾(runleanleft), 跑右傾(runleanright)動畫.這意味著你需要多做4個動畫片斷! 制作這么多數(shù)量的動畫會累死人的. 而附加動畫(Additive animations) 和混合(Mixing) 可以大大減少這些工作量!附加動畫范例 Additive Animation Example附加動畫允許你在頂層覆蓋其他所有可能播放的動畫的效果( allow you to overlay the effects of animation on top of any others that may be playing). 當你制作一個附加動畫時, Unity將計算動畫片斷里的第一幀 (first frame)和當前幀(current frame)的差異. 然后它將在所有其他播放的動畫之上應用這個差異(Then it will apply this difference on top of all other playing animations).現(xiàn)在你只需要制作一個左傾( leanleft) 和右傾( leanright)動畫. Unity將為此傾斜動畫新建一個層并置于walk, idle 或 run循環(huán)的層級之上.下面是代碼Here is the