Closed mapedorr closed 1 year ago
Possibly related to #44721.
I don't have access to a PS4 controller; so, to help with troubleshooting, please provide the output (which button number or numbers is reported to be pressed) for each direction of the D-Pad when running the Joypads demo under both 3.2.3-stable and 3.2.4.rc1.
Thanks @madmiraal
The button numbers for 3.2.3-stable and 3.2.4.rc1 are the same.
Let me know if I can help with something else.
@mapedorr I'm struggling to understand what the problem is and it's difficult to tell from the video what is happening vs what is expected. With the joystick connected, please complete the following table:
Expected | What it does in 3.2.3 | What it does in 3.2.4.rc1 | |
---|---|---|---|
Doing Nothing | Nothing | ||
W pressed | |||
A pressed | |||
S pressed | |||
D pressed | |||
D-pad Up | |||
D-pad Left | |||
D-pad Down | |||
D-pad Right |
@madmiraal Hi, sorry for the late response and for not making clear what's going on.
Expected | What it does in 3.2.3 | What it does in 3.2.4.rc1 | |
---|---|---|---|
Doing Nothing | Nothing | Nothing | Nothing |
W pressed | Character moves up continiously | Works as expected | Character moves up and suddenly stops moving |
A pressed | Character moves left continiously | Works as expected | Character moves left and suddenly stops moving |
S pressed | Character moves down continiously | Works as expected | Character moves down and suddenly stops moving |
D pressed | Character moves right continiously | Works as expected | Character moves right and suddenly stops moving |
D-pad Up | Character moves up continiously | Works as expected | Character moves up and suddenly stops moving |
D-pad Left | Character moves left continiously | Works as expected | Character moves left and suddenly stops moving |
D-pad Down | Character moves down continiously | Works as expected | Character moves down and suddenly stops moving |
D-pad Right | Character moves right continiously | Works as expected | Character moves right and suddenly stops moving |
Same occurs for diagonals (pressing two buttons at the same time).
@mapedorr Just to clarify: It's behaving as if you've released the button when you haven't, but you don't see that in the Joypads Demo?
@madmiraal Exactly \ (-^〇^-) /
I am having this issue as well, my player stops and goes when using d-pad inputs in 3.2.4-rc2 not registering the key presses consistently. <:(
This may be a duplicate of #43674 i.e. the action_strength
is being reset to zero by the joystick due to a lack of a functioning deadzone.
@mapedorr Does the problem go away if you remove the axis mappings from the Input Map move_*
mappings?
@robertarnborg Do you also have D-Pad and Joystick movements mapped to the same input actions?
Yes @madmiraal . The problem disappears if I remove the axis mappings. 😄
@madmiraal yes, I have them mapped them to same action, in this case movement and the input is checking action_strength.
Mapping multiple keys or a key and an axis to a single action is known to cause issues: see #30888 and #39287. #30890 updated the documentation for is_action_pressed()
to highlight this, but the same applies to get_action_strength()
, which is what is happening here. This particular scenario was less evident in 3.2.3, because small movements were been filtered out (which was causing #42876, and fixed with #43233 and backported to 3.2 with #43234) but as identified in #39287, it is a pre-existing problem that doesn't have an easy fix.
@bojidar-bg suggested, changing the behaviour of is_action_pressed()
to not release until all bound buttons are released. This could be extended to get_action_strength()
, by using, for example, the maximum of multiple buttons and axes.
I'll update my code to handle this. Thank you so much for your help @madmiraal .
@mapedorr @robertarnborg I've created a PR (#47599) that should fix this problem. However, I don't have a PS4 controller to test it with. Please test it for us.
This GDScript workaround might help: https://github.com/godotengine/godot/pull/30890#issuecomment-833173710
I have noticed this same behavior for v3.3.stable.mono.official
. Disabling all axis input actions and just using dpad input actions fixed the problem for me. I was using an XInput controller (XBox 360)
I'm using Godot 3.3.1.stable and this issue is happening still, even when I have a PS4 controller connected to the USB but turned off, only recharging. Godot recognizes it as a connected joystick and when I map both a Stick axis and a keyboard key to the same action, the input stops randomly when pressing a key.
I noticed that even with the PS4 Controller turned off, Windows recognizes it as an Audio Device.
"Remover dispositivo" = Remove device
Is there a way to ignore joystick inputs besides removing them from the input mapping?
Is there a way to ignore joystick inputs besides removing them from the input mapping?
There's currently no way to disable controller support entirely, but I suppose that will need to be added eventually (e.g. with a project setting and --no-gamepad
CLI argument).
Note that this current behavior also causes issues in configurations where your keyboard is configured to send both key and gamepad events. I use a Wooting two HE analog keyboard, with the analog profile configured to send both key presses and left stick analog movement on the arrow keys. This allows using the same profile for general desktop usage and games that make use of analog movement.
This analog profile works great in games like Trackmania (even if steering is both bound to arrow keys and gamepad axes in-game). Unfortunately, it doesn't work as expected in Godot since the key and gamepad input will "fight" each other if both are configured for the same input action.
Testing project: test_analog_and_digital_input.zip
The top (white) progress bar represents the input that accepts both digital and analog input (with both inputs being sent from the keyboard). The middle (yellow) progress bar represents gamepad input only (separate action). The bottom (cyan) progress bar represents keyboard input only (another separate action).
The default deadzone is used for all inputs.
Here, I'm slowly pressing the key then depressing it:
https://user-images.githubusercontent.com/180032/137774927-79d72c26-d7fe-44e9-9956-54cbd1b75b4b.mp4
Calling Input.set_use_accumulated_input(false)
in _ready()
doesn't resolve this issue.
I am having this issue, I have WASD and a PS4 Controller, left stick axis, controlling the same inputs, and because there is no deadzone cut off, but only deadzone to activate and make true, using WASD with even a PS4 controller plugged in leads too movement stopping and starting non stop, until the PS4 Axis is moved, then for some bizarre reason now the issue is gone, and there is no way to change this using GDscript.
Issue persists on v4.0.beta9.mono.official.e780dc332
. PS4 Controller joystick + keyboard. Input cuts out.
Godot 4.0 beta 10. Seeing the same issue with the Steam Deck controller when you have d-pad and joystick input mapped to the same action.
a very niche problem that can cause issues with having a PS4 controller plugged in and trying to switch from one to the other, IE if you have both WASD and mouse enabled and also a controller it will cause issues. This can be avoided by having a menu option to switch between settings, but alot of if not the majority of games now implement a way to switch fluidly between the 2 with out them affecting each other. Not sure what causes this interaction.
https://www.reddit.com/r/godot/comments/v9bizt/comment/ic4ik6x/
Potentially to solve this issue could the input mapping have like an event priority per suggestion of workaround in this reddit thread.
"I have found a solution that seems to work OK.. I capture only the D-pad input vector, however if that's Vector2.ZERO then I'll capture the analogue stick motion and use that. So the D-pad is the dominant one, and the analogue stick is the fall back. Only issue might arise in a game where both left d-pad and left stick need to be used together, but I only have one left thumb so unlikely(? :)"
Same issue here.
Godot v4.1.dev4 (C#).
Mapped the action move_left
to the A key and left joystick to the left. Mapped move_right
to D and left joystick to the right.
Using Input.GetAxis("move_left", "move_right")
while playing with a keyboard sometimes returns 0 and makes the character stop for a fraction of a second before moving again. Playing with the controller works fine. Disconnecting the controller fixes the issue with the keyboard.
This issue was not occurring before I mapped the actions to the joystick (so using only the keyboard works fine)
Any progress on this issue other than jakeymg's workaround? madmiraal's PR (https://github.com/godotengine/godot/pull/47599) seems to work just fine, does it need more testing before merging?
Edit: jakeymg's workaround fixes the issue. Cannot think of why this should fix it other than the joystick axis not actually respecting the deadzone values set.
madmiraal's PR (https://github.com/godotengine/godot/pull/47599) seems to work just fine, does it need more testing before merging?
See https://github.com/godotengine/godot/pull/47599#issuecomment-1474668408.
Godot 4.0 beta 10. Seeing the same issue with the Steam Deck controller when you have d-pad and joystick input mapped to the same action.
@joemicmc you mean the Steam Deck itself, eh? I'm seeing d-pad work fine on PC and a controller connected to that PC, but then Steam Deck w/ linux build D-pad is only working for Menu navigation but not game input. Think it's this same issue?
@hawkerm you can test by removing any other input mappings to your in-game action and just leave the d-pad
@joemicmc yep, will try that next. I did notice that it's specific to the Controller built-in to the Steam-deck. If I connect an external controller (GuilKit) to the Steam Deck, then it's fine.
@joemicmc, I was recently hunting this issue with my game and someone playing it through a Steam Deck. Fortunately (unfortunately), someone else reported similar behavior with a different device entirely. Through testing, the different device was issuing axis events along with dpad events.
But from what I can tell with the Steam Deck's virtual controller, once it's engaged (at least with Godot) it fires off a continuous flurry of axis events at close to 0.0 levels. I believe this behavior is a mistake in the Steam Deck (hardware or software--I don't know). The resulting behavior is that even if you are listening for action events via _input, even if you are just using dpad, unwarranted axis events most likely registering under the action's dead zone will "unpress" the behavior you may have associated with dpad. And depending on how things are engineered, wonky behavior can ensue.
What does this have to do with the "different device"? Well, I had to tighten up my input processing to be robust enough to deal with both nonsensical & unexpected behavior. An easy & less ideal way out is to decouple the game pad axis from the action associated with your dpad. I'd recommend doing that unless you really need both to work.
I have the exact same issue : my controller, when plugged, is throwing some random events (the left joystick), and it calls the actions which is mapped to the "d" key of the keyboard.
I understand that this https://github.com/godotengine/godot/pull/47599 will fix the issue.
But why do we have a deadzone parameter in the "controls" section of godot if it doesn't apply ?
I mean, the events of the joystick are really small, something like 0.17, but it still sends the event wheareas the deadzone parameter is defined at 0.5 ?
I don't understand why it throw events if we have this 0.5 deadzone...
From my point of view, the deadzone parameter is not working as expected, no ?
From my point of view, the deadzone parameter is not working as expected, no ?
@jordanlis, I agree in that I was thrown off by these events coming in despite the dead zone. But when you think about it, you have to get at least one event that registers under the dead zone, in order to report the action is not "pressed". So either it is up to Godot to filter out redundant events or the onus is on Godot clients.
I believe you are advocating the former.
Note that even if that was done, it wouldn't resolve the issue @hawkerm is having. In which case, I don't think Godot can be made generally intelligent enough to handle every case without potentially stomping on another. I could be wrong.
That being said. If Godot did try to reduce redundant axis events above and below the set dead zone, it certainly would save a lot of headache.
From my point of view, the deadzone parameter is not working as expected, no ?
@jordanlis, I agree in that I was thrown off by these events coming in despite the dead zone. But when you think about it, you have to get at least one event that registers under the dead zone, in order to report the action is not "pressed". So either it is up to Godot to filter out redundant events or the onus is on Godot clients.
I believe you are advocating the former.
Well, first I don't understand the deadzone feature (how is it useful if it doesn't work as it should ?) Anyway, I'm not telling what Godot dev should do, but then If the deadzone doesn't work, without any development the issue can't be solved from what I understand. I mean I don't have any trick to prevent the d key to be released when my controller weirdly throw some events without me touching it. So my character just stops moving at all because of that, and I wish I would have a solution by script to prevent that but it's not possible.
From what I understand the only solutions are :
I just wish I could have another solution. Anyway I can be patient and wait for a next release.
Note that even if that was done, it wouldn't resolve the issue @hawkerm is having. In which case, I don't think Godot can be made generally intelligent enough to handle every case without potentially stomping on another. I could be wrong.
That being said. If Godot did try to reduce redundant axis events above and below the set dead zone, it certainly would save a lot of headache.
Totally agree on that
@jordanlis You can use jakeymg's workaround here, for now.
@jordanlis You can use jakeymg's workaround here, for now.
It seems to be a solution for dpad and joystick. Maybe it can be done the same way with keyboard / controller... I'll have to test. These days, I didn't have any issues with this joystick, the joystick seems more stable. Anyway. I know where to look when I'll try to fix it in the future.
"Device sending a flurry of events" is usually a sign of broken device and/or drivers, so it's alarming to hear that Steam Deck exhibits that behavior (it's too new to be a hardware fault)
Definitely means this issue should be given a higher priority (not to mention it's blocking an important QoL PR )
is usually a sign of broken device and/or drivers, so it's alarming to hear that Steam Deck exhibits that behavior (it's too new to be a hardware fault)
@Zireael07, yea I was surprised to see it. A user reported the associated behavior to me so I bought a Steam Deck and saw it on my own as well. The odd thing is joystick deadzones can be set & tested on a Steam Deck--when I tested mine I saw no visible jitter or movement outside the default deadzones. Worth noting again that I saw the "flurry" only after any button on the deck is engaged; until then it is silent. My gut intuition says that it's likely a software meets hardware issue on the Steam Deck's side, closely associated with behavior of the "Steam Virtual Gamepad".
Where might such an issue be reported? I assumed noting the behavior here was sufficient enough, given Valve stated they "talk to Godot" 😂: https://partner.steamgames.com/doc/steamdeck/faq
Where might such an issue be reported? I assumed noting the behavior here was sufficient enough, given Valve stated they "talk to Godot" 😂: https://partner.steamgames.com/doc/steamdeck/faq
Did they? I have not seen any Valve employee even talk about this engine, much less add to it.
My gut intuition says that it's likely a software meets hardware issue on the Steam Deck's side, closely associated with behavior of the "Steam Virtual Gamepad".
Considering that this is happening with other controllers while Steam is not running, I think it's safe to say that it's probably not Steam and more of a logic error.
I have this issue with a PlayStation DualShock 4 controller on both a Windows system and a macOS system, with Godot 4.1.1. The reproduction was the same as others are seeing here: buttons randomly stop reporting being pressed. Since I am new-ish to Godot, it wasn't obvious whether I was doing something wrong or if the issue was with the engine. Unfortunately, I lost half of a vacation day to tracking down the root issue (combining buttons and joystick inputs). I got to learn a bit about Godot in the process, so it wasn't entirely wasted, but I can't imagine the Godot maintainers want new users to go through this frustrating experience.
If the Godot maintainers are not ready to merge the proposed patch, please consider adding a warning in the Input Map dialog that says "Combining Joystick and Button presses in the input map is not supported: see issue #45628"; or disable combining buttons with joystick axes entirely. The warning/error would have saved frustration; and I can see from the comments on this issue it would help others as well.
For others who run into this, here is my workaround:
For player input handling, the following picks the greater of button or analog input:
func get_vector_for_input_prefix(prefix) -> Vector2:
return Input.get_vector(prefix + "move_left", prefix + "move_right", prefix + "move_up", prefix + "move_down")
func _physics_process(delta):
# Workaround bug when mapping both buttons and analog inputs to a single event:
#
# https://github.com/godotengine/godot/issues/45628
#
# If the bug is fixed, switch the below block of code to simply:
#
# var input: Vector2 = Input.get_vector("left", "right", "up", "down")
#
var input: Vector2 = Vector2.ZERO
var analog_input: Vector2 = get_vector_for_input_prefix("analog_")
var button_input: Vector2 = get_vector_for_input_prefix("button_")
if analog_input.length() > button_input.length():
input = analog_input
else:
input = button_input
velocity = input * SPEED_PIXELS_PER_SEC / delta
move_and_slide()
The input map looks like this:
Keywords to help others find this issue and workaround: Input.get_vector
, Input.is_action_pressed
, joystick, buttons, character movement
I'm completely new with godot since a few days ago and immediately ran into this issue in my first 30 minutes of making a project and trying to make a character move. I had no idea this had anything to do with a controller being connected so it took me days to figure out this was the issue.
I did figure out that 4.0 and 4.0.4 don't seem to have this issue at least for me. I only have this problem in 4.1 and 4.1.1.
In my completely clueless opinion as someone new to the engine, maybe the default behavior for godot should be to only accept inputs from either controllers or keyboards, not both at the same time? If this kind of functionality is wanted it should be a choice by the developer? Or go back to the handling in 4.0 where this wasn't an issue?
I did figure out that 4.0 and 4.0.4 don't seem to have this issue at least for me. I only have this problem in 4.1 and 4.1.1.
This issue isn't new in 4.1. It's also present in 3.x.
In my completely clueless opinion as someone new to the engine, maybe the default behavior for godot should be to only accept inputs from either controllers or keyboards, not both at the same time?
It's likely feasible to ignore inputs that don't come from the last used device type (controller or keyboard), but a proper fix will probably require not much more effort than a workaround like that.
I can't reproduce this bug in 4.2 dev using the attached project. I tested with Xbox controller though.
Oooh, I will test in the next 4.2 release with my Steam Deck as that is where I saw issue.
Nice. Will this fix end up in 3.6 too at some point?
Nice. Will this fix end up in 3.6 too at some point?
Yes (if the fix is confirmed to work correctly), but the fix can't be trivially cherry-picked. It shouldn't be too difficult to redo for 3.x
, but a new PR needs to be opened.
Edit: This issue needs to be fixed first: https://github.com/godotengine/godot/issues/81164
The following issue described in https://github.com/godotengine/godot/issues/68433 is still happening on 4.2-beta1:
One axis should be 1, the other 0 if you press a single key, however I get values such as (0.998444, 0.055762) if either:
- the application has just started, or
- for a short while after using the controller.
I have found this to be true if a ps5 dualsense is plugged in while pressing keys. When the dual sense is unplugged, this does not happen to the keyboard inputs.
This is still an issue for me on Godot 3.6. I confirmed using the sample project.
Used a PS4 DualShock controller, Windows.
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Godot version: 3.2.4.rc1.official
OS/device including version: Windows 10 (19042.746)
Issue description: When I plug in a PS4 controller, KinematicBody2D doesn't move properly while using the d-pad buttons or the keyboard. Same occurs if I use DS4Windows to emulate a Xbox 360 controller (XInput).
(!) Note The same code works fine in Godot v3.2.3.stable, both for the PS4 controller (with and without DS4Windows) and the keyboard.
Steps to reproduce:
Repeat steps 1 and 2 in Godot v3.2.3.stable.official and the rectangle will move without problems.
Minimal reproduction project:
GamepadInputError.zip