x


[SOLVED] Input.GetAxis("Horizontal") returns wrong value?

Disclaimer: Just downloaded Unity for the first time today

When I started Unity and tried the demo, the character kept running to the left, this seemed strange to me, so I investigated the code, and came to the conclusion that Input.GetAxis("Horisontal") and Input.GetAxis("Vertical") returned the wrong values (-1 and 1 when no keys were pressed) equipped with that suspicion I made this demo file:

using UnityEngine;

public class MoveMe : MonoBehaviour 
{

    void Update() 
    {
        Debug.Log("X=" + Input.GetAxisRaw("Horizontal") + " Y=" + Input.GetAxisRaw("Vertical"))
    }
}

and once I ran it It returned

X=-1 Y=1

When I didn't touch any keys... I have tried remapping the Input, just in case that it had something to do with my keyboard or something, but that didn't change anything...

Any help would be much appreciated, as I'd really like to get started on Unity3d development

Note: I'm using C#, and I have a pretty decent knowledge of it, so you don't have to dumb down your answers for me (but please do explain them)

more ▼

asked Feb 01, 2012 at 11:46 PM

bnm12 gravatar image

bnm12
16 3 2 2

Do you have any joysticks or gamepads plugged in? I strongly suspect that it's something to do with your local setup, because I'm not getting anything like that here.

Feb 03, 2012 at 08:36 AM syclamoth

I don't have any as far as I can tell, but now that you mention it, I did install a gamepad emulator some time ago, maybe there's something with that driver... I'll have a look...

Feb 03, 2012 at 08:42 AM bnm12

Uninstalled the emulation (Vjoy if anyone have the same problem) and it now seems to work!! Thanks for reminding me of that :) Now off to learn Unity...

Feb 03, 2012 at 09:05 AM bnm12
(comments are locked)
10|3000 characters needed characters left

-1 answers: sort oldest
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1525
x899
x60
x57
x3

asked: Feb 01, 2012 at 11:46 PM

Seen: 2063 times

Last Updated: Feb 03, 2012 at 09:49 AM