- Home /
Maximum Rotation
Alright, yes. I asked this question before.
But there is a twist! See, I got this code working -thanks to Bobadebob.
function Update ()
{
if (transform.eulerAngles.y >= 10)
transform.eulerAngles.y = 10;
if (transform.eulerAngles.y <= -10)
transform.eulerAngles.y = -10;
}
But ever since -10 = 350 and the other way around. So the model skips between 10 and -10 all the time whenever I exceed the maximum or minimum. I just wan't my model to not be able to exceed the angle of 10 and -10(350).
Answer by Ashkan_gc · Mar 13, 2011 at 02:30 PM
yes they are them same (-10 = 350) so use only positive numbers and you will be good to go. because 355 is greater than 10 and also less than -10. unity don't use euler angles for calculations so i don't know what exactly will happen.
but if it is 350 it is really -10 yet his code would set it to 10, which is not right
also set all rotations at once...the docs say you will get drift if you set only one angle...
That won't work either. Ever since 350 also is more then 10 it might and will jump to 10 or -10 Its quite random. I just want my model to not be able to exceed those limits. This script wont work.
Your answer
Follow this Question
Related Questions
Mouse look X axis not working? 0 Answers
Maximum Rotation 1 Answer
mathf.min and mathf.max 3 Answers
How would I find multiple peaks and valleys in an array of values? 1 Answer
how to set a max health and mana 1 Answer