- Home /
 
mouse x not working when mouse y in use?
so i have this script for mouse to move the model and the mouse x dose not work with this script:
 {
         // Rotation
 
         rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
         transform.Rotate(0, rotLeftRight, 0);
 
        verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
        transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);
     }
 
               but... if i // out the mouse y lines:
 {
         // Rotation
 
         rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
         transform.Rotate(0, rotLeftRight, 0);
 
      //   verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
       //  transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);
     }
 
               the mouse x works so ya please help me (I have no idea what i am doing LOL)
               Comment
              
 
               
              Answer by Zodiarc · Sep 09, 2016 at 11:43 AM
Because you are setting the rotation back to 0 with
transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);
try this (pseudocode):
 xRotation = Input.GetAxis("Mouse X") * sensitivity
 yRotation = Input.GetAxis("Mouse Y") * sensitivity
 
 transform.Rotate(yRotation, xRotation, 0)
 
              so i tried that but it did not work
i am using this TUT: https://www.youtube.com/playlist?list=PLbghT7$$anonymous$$mckI4su9o$$anonymous$$noLuoRYLUv$$anonymous$$lek7j
Your answer