- Home /
Rotation on the negative X axis won't be checked..
Hello Devs! I have problem with checking if my negative x rotation is less than -25f..I want to stop rotation at -25f if the rotation is less than -25f, but this if statement dont even print something in the console if rotation is less than -25f.. This is my code, and i have the exactly same code right below, except values is positive and that code work perfect, but this code with just negative values dont work, i really dont know why?! Image of my code is below..
Answer by DanW · Jan 18, 2018 at 08:24 PM
My guess is that the math in your Rotate method is yielding a value greater than -25. What is the value of rotationSpeed?
Answer by Megii · Jan 18, 2018 at 10:47 PM
rotationSpeed is 1f, but it definitely yielding greater than -25f, why? I dont know, but, very confusing thing is that i have exactly same code below this code, and only difference is that his values is positive, and he work very fine, but this code where i use just negative numbers for the check rotation and stop her instead of code which work, it doesn't work..Below is image of code that work good, and only diffeence is the possitive and negative values :
transform.eularangles will always return a positive number. To get it to a negative, see this answer Here
Your answer
Follow this Question
Related Questions
How to constantly rotate an object to 0f by X-axis? 2 Answers
Trouble Rotating an Object on x-axis 1 Answer
Cube Rotation Problem 0 Answers