Answer the question
In order to leave comments, you need to log in
How to smoothly rotate an object (code doesn't work)?
It is necessary to smoothly rotate the object along the x-axis (horizontal) by pressing the button.
Here's a working code that will sharply rotate an object.
public void RotateIt()
{
GameObject imageCharacter = GameObject.Find("Image-Character");
imageCharacter.transform.rotation = Quaternion.Euler(0, 180, 0); // Резкий поворот. Работает.
}
public void RotateIt()
{
GameObject imageCharacter = GameObject.Find("Image-Character");
imageCharacter.transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, 180, 0), Time.deltaTime); // Плавный поворот. Не работает.
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question