- Home /
Input Snap option not returning 0?
Hi!
So, I'm moving my character (2D game) with these 2 lines of coding
float move = Input.GetAxis ("Horizontal");
rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
And it works... But if I press, let's say, the right key for a short moment and then press the left key, the command GetAxis won't return me 0. Instead, it constantly returns the value move was when I pressed the left key.
I don't know if I'm being clear. It's something like this:
Pressing right --> 0.1
Pressing right --> 0.3
Pressing right --> 0.5
Pressing right and left --> 0.5
Pressing right and left --> 0.5
And so on..
According to the Unity Documentation:
If (snap is) enabled, the axis value will be immediately reset to zero after it receives opposite inputs. Only used when the Type is key / mouse button.
(http://docs.unity3d.com/Manual/class-InputManager.html)
And looks like that's not happening, so... I'm lost. Any thoughts?