You’re neither doing something wrong, nor is it a bug.
Gamepad joysticks are often not centered 100% and also wear down and loose precision over time, so this is a hardware problem. So far I’ve tested like 8 different controllers and only one or two actually reset to a perfect 0.0 value.
Maybe the documentation could be improved a little in this regard… something like “a value approaching zero means the axis is in neutral position”
The best practise here is to have some kind of deadzone handling in your gameplay code.
The reason godot doesn’t handle gamepad deadzones internally, is that there’s many different ways of achieving this. You could have a circular-deadzone, a square one, an axis-independent one, etc… Each having a different kind of effect on the “feel” of your gameplay, so it’s up to the user to decide on how to apply the deadzone.
Not a bug or you doing anything wrong; it’s because there’s no deadzone, and it depends on your joystick. A gamepad, depending on which one you have and how used it is, may be pretty bad at springing back to (0, 0), especially if you release it from full extension.
It’s pretty easy to code in a deadzone yourself though. There are multiple ways, here’s one:
var deadzone = 0.25
func _input(ev):
if ev.type == InputEvent.JOYSTICK_MOTION:
if ev.axis == 0:
left_joy_angle.x = ev.value
elif ev.axis == 1:
left_joy_angle.y = ev.value
if left_joy_angle.length() <= deadzone:
left_joy_angle = Vector2(0, 0)