Unable to get joystick values, while buttons work fine

Godot Version

4.4.1

Question

I’m having trouble getting any analog joystick values from my gamepad. The sticks work correctly (verified by Hardware Tester), and I can get input events from the buttons just fine.

But I cannot get any values from any joystick. I checked for InputEventJoypadMotion events in _input(), and I get none. Input.get_axis("stick_left", "stick_right") remains zero when I jiggle the sticks (I have added all stick axes to the “stick_xxx” events), and so does get_joy_axis().

The button events, however, work fine (even those mapped to the D-pad). Any ideas what I could try?

Don’t you have the deadzone set too high for the actions that are mapped to joystick axes? Try using Input.get_action_strength according to the instructions in the documentation:

What kind of controller is it? Do the sticks work on anything else?

Nope, no values on Input.get_action_strength() either. The deadzone has the default value of 0.2; event setting it to 0.0 doesn’t change anything. I would normally assume that my gamepad has a problem, but on the the hardwaretester.com site, the sticks both work perfectly.

Changing the deadzone to zero would introduce jitter anyway, as all controllers have some.

Hence why the default is 0.2. If setting to zero and you still are not getting anything back then thats probably a driver issue.

Just because hardwaretester works doesn’t mean its going to with Godot.

Whats the hardware?

The controller is an Xbox-type clone. Input.get_joy_name(0) returns “Xbox Wireless Controller”. I don’t own any games that use the sticks, so I can only test it with the hardware test site mentioned in my original post, and they work perfectly there,

Trackmania is a free-to-play game that uses a controller.

That suggests Godot is picking it up. Can you provide the full code please.

OK, more testing: I’ve downloaded the official Godot “Joypads (Gamepads) Demo” from Joypads (Gamepads) Demo - Godot Asset Library and it doesn’t recognize the stick movement either. Almost all buttons work (even the “stick buttons”, ie. pressing on the stick), except the lower triggers, which do work on the hardwaretester site.
The gamepad’s UUID is 58626f7820576972656c65737320436f, and it is included in the Godot gamecontrollerdb.txt file, which makes me think it should work… The entry does say platform:Android, though, but I’m, not sure what this means…?

Well, yes. As I wrote, button presses are registered, just not the analog sticks.

As for the code… not much:

extends Control

var gamepad_found := false

func _process(delta: float) -> void: 
	if !gamepad_found:
		var pads := Input.get_connected_joypads()
		if (pads.size() > 0):
			print("Connected joypads:", pads)
			var joy_name = Input.get_joy_name(0)
			var joy_info = Input.get_joy_info(0)
			print("Joystick name: %s" % joy_name);
			print("Joystick info:", joy_info)
			gamepad_found = true

	var joy_velocity = Vector2(
		Input.get_action_strength("stick_right") - Input.get_action_strength("stick_left"),
		Input.get_action_strength("stick_down") - Input.get_action_strength("stick_up")
	).limit_length(1.0)
	var strength_right := Input.get_action_strength("stick_right")
	print("Velocity: ", joy_velocity, ", Strength R: ", strength_right)

The output:

Godot Engine v4.4.1.stable.official.49a5bc7b6 - https://godotengine.org
Vulkan 1.2.283 - Forward+ - Using Device #0: Intel - Intel Iris Pro Graphics

Velocity: (0.0, 0.0), Strength R: 0.0
Velocity: (0.0, 0.0), Strength R: 0.0
Connected joypads:[0]
Joystick name: Xbox Wireless Controller
Joystick info:{  }
Velocity: (0.0, 0.0), Strength R: 0.0
Velocity: (0.0, 0.0), Strength R: 0.0
...

All numbers stay at zero, all the time.

The fact that the gamepads demo doesn’t work is weird.

How are you connecting the controller? USB, Xbox 2.4Ghz dongle or Bluetooth?

If bluetooth then that could explain it, as its in the Android section of the DB.

Yes, it makes me think that Godot has problems accessing the stick values. It can’t be (or, is very unlikely to be) the OS or the gamepad, as the hardwaretester site can see the stick movements, so the gamepad->BT->Mac->macOS->browser->JS path works.

Bluetooth.

Can you explain that a little more?

So if you are connecting to bluetooth, then it makes sense for the controller to be in the Android section as thats more than likely the device type its supposed to connect to rather than Windows.

It may only be marketed as a controller for Android, and hence why its only in that section of the DB. Thats the only reason I can think of as to why its not working.

If you can connect it via USB try that first.

The controller is designed for Xbox, Windows, Mac, iOS, tvOS, and a whole bunch of other platforms (probably Android, too.) Doesn’t work with USB, though. But again: The sticks are working, it’s only Godot that doesn’t see them. (I’m on macOS, btw.)
What does it mean when a controller is listed with “platform:Android”? I don’t think it means “this controller works only on Android” (the whole section wouldn’t make any sense then, since there is no Godot IDE on Android.)
I think there’s probably something wrong with the way Godot maps this controller’s inputs to the axes (likely something to do with the leftx:a0,lefty:a1 part of that record, but that’s just a guess.)

You could try with get_action_raw_strength() to see if it’s a deadzone problem…