Unity Mathf

时间:2015-05-11 11:06:46   收藏:0   阅读:307

1、Lerp 线性移动

float startTime = 1f;//动画持续的时间为1秒
//start开始状态
//end结束状态
//startTime为持续的时间
float current = Mathf.Lerp/LerpAngle(start, end, Time.time - startTime)

使用方法

public void Update() {
    transform.position = new Vecter3(Mathf.Lerp(start,end,Time.time - startTime),...y,...z);
}

2、LerpAngle

使用方法

public void Update() {
    transform.eulerAngles = new Vecter3(...x,current , ...z);
}

3、MoveTowards

匀速运动

public void Update() {
    //speed速度
    transform.eulerAngles = new Vecter3(...x,Mathf.MoveTowards(satrt,end,speed) , ...z);
}


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!