Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS4/Dual Shock 4 controller analogue input causes actions to ignore other connected controllers' analogue input events #86272

Open
SophieH opened this issue Dec 17, 2023 · 5 comments

Comments

@SophieH
Copy link

SophieH commented Dec 17, 2023

Tested versions

Reproducible in v4.2.1.stable.official [b09f793]

System information

Dual Shock 4 (PS4 controller) + other controllers (I used xbox, PS5, etc). Copied info: Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz (4 Threads)

Issue description

With multiple controllers connected, if one is a PS4/DS4 controller, other controllers' analogue inputs for an action shared by the PS4/DS4 will often be ignored when getting the action strength.

Getting the action strength seems to behave correctly exactly when a controller changes its axis value, but the action strength quickly zeroes again, presumably related to how 'flickery' the raw DS4 analogue input is.

To be clear:

  • digital (non-analogue) inputs are not interrupted
  • playing with a controller is fine if the DS4 is not connected
  • playing with a DS4 is fine even if other controllers are connected
  • using Input.get_joy_axis() behaves as expected even when the DS4 is interfering with action strength

I assume this is related to a previous bug where the PS4 controller would make keyboard input actions cut out despite being stronger. It may have existed then too and just not been noticed.

sorry if this report isn't the best, I'm not used to doing this! I'll help more if I can.

Steps to reproduce

Attach my code to a label, have a "Left" action in the InputMap with an event listening for analogue stick left.
You'll need the PS4/DS4 controller and at least one other kind of controller, both connected.

You'll notice the "Input Action" will frequently go to 0 when using a non-DS4 controller while the DS4 is connected, and works fine if the DS4 is unplugged. The DS4 itself seems to work fine.
As you can see from the get_joy_axis() values, all controllers are reporting their values correctly, the issue is with the action strength.

Minimal reproduction project (MRP)

extends Label

func _process(delta):
	var actionName = "Left"
	# cuts to 0 sometimes if a DS4 is connected:
	text = "Input Action:" + str(Input.get_action_strength(actionName)) 

	# inputs from specific gamepads still report correctly
	var events:Array[InputEvent] = InputMap.action_get_events(actionName)
	var analogueInput:InputEventJoypadMotion
	for e in events:
		if e is InputEventJoypadMotion:
			analogueInput = e

	for j in Input.get_connected_joypads():
		text += "\n" + Input.get_joy_name(j) + str(Input.get_joy_axis(j, analogueInput.axis))
@Calinou
Copy link
Member

Calinou commented Dec 17, 2023

I assume this is related to a previous bug where the PS4 controller would make keyboard input actions cut out despite being stronger. It may have existed then too and just not been noticed.

#45628 should definitely have been fixed since 4.2. I can't reproduce it at all since 4.2 on my end when using multiple controllers.

@slumberface
Copy link

I think this is the same issue I detailed on #45628. in 4.2.1, if build is started with dual sense plugged in it will add tiny incorrect values to digital keyboard inputs. Instead of 0 you will get stuff like -.01545. Still bugged.

Steps to reproduce plug in a dual sense, start build, print keyboard values on input

@Calinou
Copy link
Member

Calinou commented Feb 10, 2024

@slumberface
Copy link

slumberface commented Feb 10, 2024

@Calinou Hey I just posted a reply that said this fixes it but it doesn't. The test doesn't reveal the conditions that cause this error to surface for me. With this code the bug comes up. If a dual sense is also plugged in, then pressing up on the keyboard (y axis) will also give you small floating point values in the x axis
image
image

Maybe this isn't the best way to be polling for input in the first place, but does this illuminate the issue a bit more?
It's also worth noting that this problem persists even when the controller is then unplugged while playing the scene. The controller has to be unplugged before the scene is played for no fuzz on the axis.

@slumberface
Copy link

@Calinou replied to other thread. this might be a problem with Input.get_vector specifically (using the 5th parameter doesn't help). Polling this way doesn't run into the same issue:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants