Question by 
               blingximus · Mar 07, 2016 at 03:36 PM · 
                transform.rotationtransform.  
              
 
              Rotate 3d character in 2d space
I been struggling with this issue for 3 days now.
Searched the answers and still nothing concrete.
All I want is for my 3d character to look left and right.
But the rotation inputs get messed up somehow and it's like I cant edit the rotation values to just go back and forth between two Y values. below is my code.
     public float xRotation = 0f;
     public float yRotation = 90.0f;
     public float yrRotation = -90.0f;
     public float zRotation = 0f;
 
     bool facingRight = true;
 
     void FixedUpdate()
     {
       float move = Input.GetAxis("Horizontal");
     
       if (move > 0 && !facingRight)
         {
            
             facingRight = !facingRight;
             transform.localEulerAngles = new Vector3(xRotation, yrRotation, zRotation);
 
             Debug.Log("Transform: " + transform.localEulerAngles.ToString());
         }
         else if (move < 0 && facingRight)
         {
             
             facingRight = !facingRight;
             transform.localEulerAngles = new Vector3(xRotation, yRotation, zRotation);
 
             Debug.Log("Transform: "+transform.localEulerAngles.ToString());
 
         }
 
 }
 
               LOGS:
When I look left: Transform: (0.0, 180.0, 0.0)
When I look right: Transform: (0.0, 358.0, 0.0)
How can make my character just rotate a fixed amount back and forth every time?
               Comment
              
 
               
              Your answer