Question by 
               MathBaldUG · Jun 22, 2018 at 09:08 PM · 
                rotationunity 2drotate objecteulerangles  
              
 
              How to stop the Rotation at eulerAngle.z(-40)
Hey Guys,
I have the problem that my GameObject doesn't stop rotating, while pressing KeyCode.RightArrow, at eulerAngle.z(-40). It does stop with this code at eulerAngle.z(40) while pressing KeyCode.LeftArrow, which is the left-rotation.
can Somebody tell me how to stop rotating when reaching eulerAngle.z(-40).
Thank you
     if (Input.GetKey(KeyCode.LeftArrow))
         {
         zNeu ++;
         if (zNeu > 40)
             zNeu = 40;
         }
     else if (Input.GetKey(KeyCode.RightArrow))
         {
         zNeu --;
         if (zNeu < -40)
             zNeu = -40;
       
         }
     transform.eulerAngles = new Vector3(0, 0, zNeu);
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Convert movement direction into rotation? 0 Answers
Help with suns rotation 0 Answers
how to get object rotation? 1 Answer
Rotation Issue 0 Answers