- Home /
Question by
SrCienpies · Feb 12, 2020 at 01:46 PM ·
rotationrotaterotatetowards
Rotate towards 270 degrees,Rotate Towards 270
Hello everyone, basically i want to rotate smoothly as Rotate Towards do, but i had a problem when i want to rotate from 0 to 270 degrees unity detect the fastest way to do it, what is not the way that i want.
What shoud i do?
ejemplo-rotacion.png
(18.9 kB)
Comment
Best Answer
Answer by tormentoarmagedoom · Feb 12, 2020 at 03:44 PM
Hello there.
Then make the rotation yourself. Do not use RotateTowards. You should use
Object.tranform.Rotate(x,y,z)
If you create a corutine, each frame the object will rotate the amount you want, for example:
IEnumerator RotateObject()
{
Object.tranform.Rotate(x,y,2);
yield return null;
if (Object.transform.eulerAngles.z < 270)
{
StartCoroutine(RotateObject);
}
}
And check if rotation reached the angle you want.
This way, each frame will rotate 2º in z axys and check if need to continue rotating at next frame. Once Z>270 corutine will stop calling itself.
Good luck!
Thanks for your answer, i will try it right now and tell you the results
Your answer
![](https://koobas.hobune.stream/wayback/20220612223158im_/https://answers.unity.com/themes/thub/images/avi.jpg)