找回密碼
 注冊帳號

掃一掃,訪問微社區

animation.synclayer 同步層

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

摘要: animation.synclayer 同步層functionsynclayer(layer: int) : voiddescription描述synchronizes playback speed of all animations in the layer.同步某層的動畫的播放速度。when blending between two looping anim ...

animation.synclayer 同步層

functionsynclayer(layer: int) : void

description描述

synchronizes playback speed of all animations in the layer.

同步某層的動畫的播放速度。

when blending between two looping animations they often have different lengths. for example a walk cycle often takes longer than a run cycle. when blending between them you need to make sure that the foot placement of the walk and run cycle happens at the same time. in other word playback speed of the animations must be adjusted so that the animations are synchronized. synclayer will calculate the average normalized playback speed of all animations in the layer based on their blend weight. then it will apply that playback speed to all animations in the layer.

在混合兩個循環動畫的時候,他們通常有不同的長度。比如一個走路的動畫通常比一個跑步的動畫要長。當混合他們的時候,你需要確定走路和跑步動畫發生的時候腳的位置要在同一時間走動。換句話說,這兩個動畫播放速度要被調整一致,以便動畫的同步。synclayer函數將根據動畫的混合權重來計算同一層中動畫的平均正常播放速度。然后它會給同一層的所有動畫應用這個播放速度。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

public void awake() {

animation["walk"].layer = 1;

animation["run"].layer = 1;

animation.synclayer(1);

}

}

// puts the walk and run animation in the same

// layer and synchronizes their speed

// 把walk和run動畫放到同一層,然后同步他們的速度。

animation["walk"].layer = 1;

animation["run"].layer = 1;

animation.synclayer(1);

文章點評
女校游泳队彩金