- Home /
Help with Input.GetAxis???
On one of the chapters about programming in this book im learning from, on one of the script examples there is a line consisting of input.getaxis for mouse detection. This is the line of code:
target.transform.Rotate(Input.GetAxis("Mouse Y") 3F, -Input.GetAxis("Mouse X") 3F, 0F);
I was wondering why there is a minus sign before the second Input.GetAxis? and does this make any difference whether it is there or not. When i run the code it doesnt appear to make any difference whether to minus sign is there or not...
(Btw I am using Unity 4.3 if that makes any difference)
Answer by allenallenallen · Aug 03, 2015 at 05:49 AM
Here, if you're new to programming, Unity Documentation comes in real handy: http://docs.unity3d.com/ScriptReference/Input.GetAxis.html
Copied from the documentation: "If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1."
Putting a negative in front should switch the direction of whatever you want to accomplish. It SHOULD make a difference. Either you didn't notice or there is another script that changes the rotation again elsewhere.