[英]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.