Two Horizontal Movement Axes Behaving Differently

I’m using transform.translate to move a gameobject based on an input.getaxis command. I’ve set up two horizontal axes, one for keyboard inputs and one for joystick input. When you use the keyboard keys (a and d) for movement, you get a smoothing effect that makes the object glide a little after you let go of the key. On the joystick (xbox analog stick) this does not happen and the object stops as soon as you let go.

Can anyone tell me specifically why these two axes behave differently, and how I can get the smoothing effect to happen on the joystick axis? Code and input axes below for reference. Thanks.

void Update()
          float translation = Input.GetAxis("Horizontal") * speed;
          translation *= Time.deltaTime;
          transform.Translate(translation, 0, 0, Space.World);



From the documentation on Unity’s Input Manager:

Gravity: How fast will the input
recenter. Only used when the Type is
key / mouse button.

Sensitivity: For keyboard input, a
larger value will result in faster
response time. A lower value will be
more smooth. For Mouse delta the value
will scale the actual mouse delta.

Snap: If enabled, the axis value will
be immediately reset to zero after it
receives opposite inputs. Only used
when the Type is key / mouse button.

The analog stick is simply used as-is. The keyboard input, however, is simulating that smoothed input instead.

With that in mind, the opposite effect can easily be achieved for keyboard controls. As you can find in other Input assignments, other button presses are often set to include:

  • Gravity: 1000
  • Dead: 0.001
  • Sensitivity: 1000

This results in inputs with immediate feedback.

Even more to the point, you can instead take the direct input using Input.GetAxisRaw() and add smoothing yourself if you want to apply it to both keyboard and analog stick.