码迷,mamicode.com
首页 > 编程语言 > 详细

Unity Mathf

时间:2015-05-11 11:06:46      阅读:307      评论:0      收藏:0      [点我收藏+]

标签:

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);
}


Unity Mathf

标签:

原文地址:http://my.oschina.net/u/1273583/blog/413150

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!