1

ウェイポイントに配置された球形をゆっくりと回転させる必要があります。ゆっくり回転させる必要があります。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;
}
4

1 に答える 1

2

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);
}
于 2013-06-26T09:49:31.630 に答える