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

Prevent axis-based actions from getting stuck #81170

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Aug 30, 2023

Fixes #81164

Not sure how much correct is that. This assumes that only InputEventJoypadMotion has this problem and that you have only single axis event assigned to an action (which is true in 99.9% cases). Also a special handler for one event type feels hacky.

@KoBeWi KoBeWi added this to the 4.2 milestone Aug 30, 2023
@KoBeWi KoBeWi requested a review from a team as a code owner August 30, 2023 15:20
core/input/input.cpp Outdated Show resolved Hide resolved
core/input/input.cpp Outdated Show resolved Hide resolved
@KoBeWi KoBeWi force-pushed the step_input branch 2 times, most recently from 9a9bf6f to 3204ec2 Compare August 30, 2023 18:27
Copy link
Contributor

@Sauermann Sauermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is difficult to review, because I cant test the PR.
I'm not sure if there is a better way to fix the bug, but I can follow the argumentation of the shortcomings in the OP and understand the changes.

So this is a "it will not worsen the situation" review approval.

@Calinou
Copy link
Member

Calinou commented Aug 30, 2023

This doesn't appear to work correctly on my end (using keyboard and wired DualSense on Linux at the same time). In fact, I can still notice #45628 happening on my end (look at times when I press keyboard keys while keeping the gamepad axis still):

simplescreenrecorder-2023-08-30_23.27.10.mp4

CheckBox indicates state of is_action_pressed(), left ProgressBar is the action strength, right Progressbar is the action raw strength.

Testing project: test_analog_and_digital_input_2.zip

core/input/input.cpp Outdated Show resolved Hide resolved
@KoBeWi
Copy link
Member Author

KoBeWi commented Sep 2, 2023

Fixed. It was the same issue - the action was released multiple times in a row.
Thinking again, the issue makes sense. Axis actions are pressed based on the deadzone, so if you receive multiple events above or below deadzone, the action state will change abnormally.

core/input/input.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@Sauermann Sauermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Origin for this PR is #80859, which originally intended to fix #45628. Since I can't replicate that issue, I can't verify that.

#80859 introduced #81164 which this PR intends to fix. I can confirm #81164 in v4.2.dev4.official [549fcce]
With this PR applied to v4.2.dev.custom_build [fb4edf5], I tried for over a minute to cause, #81164 but was unsuccessful to do that. So I am confident, that this PR fixes that issue.

Comment #81170 (comment) mentioned a problem, that a previous version of this PR introduced and I have tested and can confirm, that this has been fixed in the latest update.

The concerns of my comments regarding the implementation also have been solved.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine, and I don't see any regression on the joypads demo.

@akien-mga akien-mga merged commit 5f5ca23 into godotengine:master Sep 11, 2023
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the step_input branch September 11, 2023 14:09
@Qainguin Qainguin mentioned this pull request Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Axis-based actions can get stuck as pressed
4 participants