/ / Como girar lentamente formas esféricas usando o Lerp? - c # -4.0, vetor, unity3d

Como girar lentamente formas esféricas usando o Lerp? - c # -4.0, vetor, unity3d

Eu preciso girar lentamente formas esféricas que são colocadas em waypoints. Precisa girar devagar. Como posso conseguir isso com o Lerp?

O código que tenho atualmente:

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

Respostas:

2 para resposta № 1

Veja como usar o Quaternion.Lerp on o site wiki.

Usando esse exemplo:

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