layer 同步调用_Unity5.0_Animation.SyncLayer 同步层_软件教程_资源库

摘要:Unity5.0_Animation.SyncLayer 同步层_软件教程_资源库

Animation.SyncLayer 同步层

function SyncLayer (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);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值