Rotation on the negative X axis will not be checked..

Updated on January 18, 2018 in General
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on January 18, 2018

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?

if (Input.GetKey(KeyCode.DownArrow))
myBody.velocity = new Vector3(0f, 0f, -smoothForceZ);
transform.Rotate(new Vector3(-100f * (Time.deltaTime * rotationSpeed), 0f, 0f));

float rotationNX = transform.eulerAngles.x;

if (rotationNX < -25f)
transform.rotation = Quaternion.Euler(new Vector3(-25f, 0f, 0f));


  • Liked by