hello,
What i’m trying to do is to rotate my object pvot from -180 to -180, so a full rotation, actually i have this
IEnumerator Rotate(float duration)
{
float startRotation = transform.eulerAngles.y;
float endRotation = startRotation + 360.0f;
float t = 0.0f;
while ( t < duration )
{
t += Time.deltaTime;
float yRotation = Mathf.Lerp(startRotation, endRotation, t / duration) % 360.0f;
transform.eulerAngles = new Vector3(transform.eulerAngles.x, yRotation,
transform.eulerAngles.z);
yield return null;
}
}
But after some degrees it will rotate in a wrong direction, i suppose because quaternion works with x,y anyone can help me to fix it?
thank’s u in advance