[英]How to slowly rotate spherical shapes using Lerp?
我需要缓慢旋转放置在航点上的球形。 它需要缓慢旋转。 如何使用Lerp做到这一点?
我目前拥有的代码:
if(!isWayPoint5)
{
//here i"m using turn by using rotate but i needed rotate
//slowly is same as turns train in track.
transform.Rotate(0,0,25);
isWayPoint5 = true;
}
在Wiki网站上查看如何使用Quaternion.Lerp 。
使用该示例:
public Transform from = this.transform;
public Transform to = this.transform.Rotate(0,0,25);
public float speed = 0.1F; //You can change how fast it goes here
void Update() {
transform.rotation = Quaternion.Lerp(from.rotation, to.rotation, Time.time * speed);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.