Unity, Y U IGNOR MY Y?

I have been trying to get my sidescroller shooter character to turn aside when the Y is higher than 90.

This is what I did:

mousepos=Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y,2));
mousepos.x=0;

if(hands.transform.rotation.y>90)
       {
       if(facefor)
         {
         facefor=false;
         me.transform.rotation=new Quaternion(0,0,0,0);

         }
       else if(!facefor)
           {
              facefor=true;
             me.transform.rotation=new Quaternion(0,-180,0,0);

           }
        }
       else
       {
         if(facefor)
          hands.LookAt(mousepos,Vector3.right);
         if(!facefor)
          hands.LookAt(mousepos,Vector3.left);    
       }

But unity ignors the Y and keeps rolling with no switch! What could I do to make things right?

Use transform.eulerAngles.y instead

I have used a vector2 and made it to switch directions when the mouse crosses the middle. :slight_smile: