- Home /
Input.GetAxis won't start working properly.
So I've had this bugging me for a while. I've tried to get my CharacterController working. It kind of works, it moves, but it never stops.
After Debug.Log it shows the following. Vertical and Horizontal movement return values '1' and '-1', even if I don't press a single key in my keyboard, so the character walks 45 degrees to left. Then again if I press S or D, it changes the values to opposite, so the values change right on press, but it never returns value 0.
I'll show few examples of the situation.
Code: http://prntscr.com/2so5k2
Input Settings(Horizontal): http://prntscr.com/2so5ow
Input Settings(Vertical): http://prntscr.com/2so5u4
I'm using Logitech G510 with Logitech gaming software as driver. Does that interfere with the program?
Answer by robertbu · Feb 15, 2014 at 05:49 PM
Does upping the 'Dead' value for the axes solve this problem?
Edit > Project Setting > Input
I changed the values to 100x the normal, and it works with not a single problem. What was causing this exactly?
I don't have a firm answer, but it is a problem I've run into. I'm guessing that your input device is analog and when the stick is centered it is still reporting a value above the original 'Dead' value.
Yeah, analog inputs are imprecise things. They almost never return exactly 0 even when the stick is centered. As they age, this gets worse, and cheaper controllers tend to have it worse than more expensive ones. That's why the "dead zone" exists, it's a region of movement that is treated as 0 for the purpose of game logic.