Trigger buttons not registering on HTML version of game on

Godot Version



I added controller support to my game and while playing in the debug, it works just fine. Same if I export an .exe version of the game and play that. When I exported a HTML5 version of the game and uploaded it to however, the trigger buttons no longer work. All the other controller buttons work without issue, only the trigger buttons don’t. I came across a reddit thread with the same issue, but no solution was found there and only a workaround presented. One of the comments suggested it might not even be an issue with Godot. It was for Godot 4.1 though, so I was wondering if a solution exists now. I tried playing on Opera with a XBOX One controller if that helps. If anyone knows what’s going on please let me know. Thanks!

It may be a browser issue. Try testing the gamepad with a gamepad tester like Hardware Tester or and see if those sites detect the triggers.

Both sites register the trigger buttons as (B)6 and (B)7, and Hardware Tester recognized those as the trigger buttons according to their diagram of the controller, so I don’t think it’s an issue of inputs being misread (unless different sites interpret inputs differently). I tried playing using Microsoft Edge and Chrome and had the same issue too.

Looks like they are detected as Standard controllers which the browser should remap automatically but something is not right, more info here [HTML5] Use internal implementation of the Gamepad API. by Faless · Pull Request #45078 · godotengine/godot · GitHub

You could check this demo godot-demo-projects/misc/joypads at master · godotengine/godot-demo-projects · GitHub and use the wizard part to create a remap string or use it as a base to remap them at runtime in your game.

I added this:

func _on_joy_connection_changed(device_id: int, connected: bool) -> void:
	var joy_name = Input.get_joy_name(device_id)
	var joy_guid = Input.get_joy_guid(device_id)
	var mapping = 'leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,a:b0,b:b1,x:b3,y:b2,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,leftstick:b10,rightstick:b11,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,guide:b16,leftstick:b10,rightstick:b11,platform:Javascript'

	var final_mapping = '%s,%s,%s' % [joy_guid, joy_name, mapping]

	Input.add_joy_mapping(final_mapping, true)
	# ...

in that demo and was able to correctly configure my 8BitDo Ultimate Wireless Controller

Thank you! I was able to remap the triggers using the wizard, though for some reason it seems to think the button is pressed even after I let it go. The picture below shows the state of the controller according to the demo after I stopped pressing any buttons.

This is the full mapping string I got from the wizard:

var mapping = "standard,Standard Gamepad Mapping,a:b0,b:b1,y:b3,x:b2,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a6,righttrigger:a7,platform:Javascript"

Interestingly, pulling the trigger is detected as “letting go” (going to 0 the more you pull the trigger), so I tried inverting it by changing the relevant part of the string to:


Which didn’t seem to change anything, so I changed the string to match the axis detected:


Which didn’t work either, same if I were to invert it by adding the ~. No matter what I did it still detected the trigger axis as 0.5 when it’s not pulled, and 0 when it’s fully pulled. Even stranger is that the demo project linked in the thread by Faless recognized the controller perfectly and detected all the inputs correctly. Do you know how to fix this? Thanks again!

I do not, sorry. You may want to comment in that PR or in one of the linked issues from that PR for help.

No worries, thanks for all the help! I’ve marked your 2nd post as the solution since it did fix the triggers not being detected. I’ll see if I can figure my other issue or get help elsewhere. Thanks again!

Quick update in case anyone comes across this thread and has the same issue. I was able to solve of my trigger being detected as being pulled when it’s not by using “get_action_strength” instead of “is_action_pressed”, like so:

var LTrigger = Input.get_action_strength("key_brake")
var RTrigger = Input.get_action_strength("key_shoot")
#Left and right triggers are mapped to "key_brake" and "key_shoot" respectively in the project settings.

if RTrigger != 0:
if LTrigger != 0:

Hope this helps!