您的位置:首页 > 移动开发 > Unity3D

Unity 插值运算 Vector3.Lerp(transform.position, targetPos, smoothing * Time.deltaTime);

2016-04-12 11:05 453 查看

1)Vector3.Lerp

v = Vector3.Lerp(Vector3 from , Vector3 to, float t)等价于

v = from + (to - from) * t

t∈[0,1]。t = 0 时,v = from; t = 1 时,v = to;

2)应用



16行 transform.position = Vector3.Lerp(transform.position, targetPos, 1* Time.deltaTime);

则表示transform所在的GameObject 从当前位置,1s之后到达目标点targetPos。

参考资料:http://www.manew.com/blog-42778-2524.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: