Skip to content

Commit

Permalink
fix: add some deadzone for joypad motion detection
Browse files Browse the repository at this point in the history
Prior to this change, if there was both a keyboard and joypad connected
and the user was using the keyboard, but there was some stick drift with
the joypad, input detection would bounce between keyboard and joypad.

This change adds a minimum axis_value that a InputEventJoypadMotion must
have before being detecting the input type as a joypad.
  • Loading branch information
raganw committed Oct 15, 2023
1 parent b7bc377 commit c494069
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/input_prompts/input_prompt_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func _input(event: InputEvent):
icons = InputPrompt.Icons.KEYBOARD
emit_signal("icons_changed")
if event is InputEventJoypadButton or event is InputEventJoypadMotion:
if event is InputEventJoypadMotion and event.axis_value < 0.05:
return
var device = event.device
var joy_name = Input.get_joy_name(device)
if joy_name.find("Xbox"):
Expand Down

0 comments on commit c494069

Please sign in to comment.