# How can I prevent movement from analog joystick “bounce”?

I'm working on a top-down game where the player can move up/down/left/right. The sprite changes to the corresponding direction, and I have an internal value that tracks the direction the player is facing.

The actual movement is handled just by doing rigidbody2D.MovePosition(player.position + movement * speed * Time.deltaTime); and it's working fine. Direction is determined by looking at the absolute values of all 4 axis values and seeing which one is greatest.

The problem I'm having is when using an analog joystick on a controller. So, if you suddenly let go of the stick, it has a little "bounce" where it goes past the center, and into the opposite direction.

I uploaded a slow-motion video of the joystick being released, to show this "bounce."

See GIF here

I added some logging to the input, and here are some numbers:

The joystick bounce always ends up being somewhere between < 0.1 to up to 0.5, for maybe 1 frame in time.

What can I do to mitigate the effects of this bounce? It's causing my player to suddenly look in the opposite direction if they suddenly stop moving.