When I attempt to use Input.GetAxis(“Horizontal”) the object is moving to the left.
The line
Debug.Log(Input.GetAxis(“Horizontal”));
returns -1 to the console when I start the program. I can change it to 1 by holding down the right key for more than second but it instantly changes back to -1 if I tap the left key.
I have disabled all inputs except the Keyboard/mouse.
Seems a little weird to me and I can’t find any other posts relating to the problem.
Here is a copy of the script.
#pragma strict
var rotationSpeed = 100;
function Update ()
{
var rotation = Input.GetAxis (“Horizontal”) * rotationSpeed;
Debug.Log(Input.GetAxis(“Horizontal”));
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
}
I tried it with the box checked and again with it unchecked. The results are exactly the same.
The ball still rolls to the left and the console still reports the Horizontal axis as reading -1.
I’d just like to add that I have drivers for a wiimote, a virtual joystick for freetrack and an xbox controller installed on this machine however they are not connected at present and I have set unity to only poll the keyboard and mouse.
There’s no bias in Unity itself; your script produces an output of 0. Typically unwanted input means you have an uncalibrated gamepad or joystick plugged in.
Cheers Eric, I suspect you may be right although I have been sure to enable keyboard and mouse exclusively.
I believe the setting in (Edit->Projects setting->input) is not strictly adhering to it’s intended purpose.
Pity really as I don’t want to uninstall every HID on the system, it took me a long time to calibrate them.
(the headtracker is a bast*rd to set up and I use it daily)
Any big brains out there have a suggestion?
I should add that every input device listed in “Game Controller Settings” (win7 x64) is calibrated and zeroed correctly.
Sorry, I cannot continue the conversation at the moment, I’ll upload screen shots tomorrow and hopefully clarify things.
Thanks for the reply’s so far. Please look in tomorrow if you have the time.
That particular input is set for key or mouse button, though. But since those are basically the input manager defaults, some of the other axes have joystick input, such as the second horizontal/vertical axes.