- Home /
Question by
Zaffer · Aug 12, 2014 at 02:39 PM ·
mouselookinput.getaxis
how to get MouseLook to stay strictly in either X or Y planes
Hi, I am trying to modify the MouseLook script to force the mouse motion to stay strictly in the X or Y planes rather than be able to tilt. Here's my code:
if (Input.GetAxis("Mouse X")){
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
}
if (Input.GetAxis ("Mouse Y")){
transform.Rotate(-Input.GetAxis("Mouse Y") * sensitivityY, 0, 0);
}
Of course this doesn't work because Input.GetAxis returns a float and I need a boolean value. Is there any way to address Input.GetAxis to find out whether it is using Mouse X or Mouse Y at any given moment. Thanks.
Zaffer
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613160433im_/https://answers.unity.com/themes/thub/images/avi.jpg)