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

Deadzone clipping in AxisSettings and ButtonSettings results in a compression of values #3450

Open
alice-i-cecile opened this issue Dec 27, 2021 · 0 comments · May be fixed by #17015
Open
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Dec 27, 2021

Problem

The current behavior of AxisSettings is:

  • If an axis's value is below the low-threshold, set them to 0.0.
  • If an axis's is above the high-threshold, set them to 1.0.

This is sensible enough, and it's useful to be able to configure this in order to control dead zones and partially account for controller drift.

However, this results in a compression of values: rather than the controller always being able to send values from -1.0 to 1.0, they can only send values in a restricted range: the high, low and near-zero values are just clipped out.

This is undesirable because it causes player-configurable settings which are intended to account for strange quirks in physical controller behavior to have unintuitive and far-reaching gameplay effects.

The same effect occurs for analogue buttons like triggers in ButtonSetttings.

Proposed Solution

Rescale values to cover the full range regardless of the configuration. The formula (for positive values) is:

let new_value = (value - positive_low) / (positive_high - positive_low);

If the game cares about the original raw input values instead, they can intercept the event stream themselves.

Alternatives

Make this a configurable setting, and keep the current behavior if the rescale_values field in the AxisSettings is set to false.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy A-Input Player input via keyboard, mouse, gamepad, and more labels Dec 27, 2021
@BenjaminBrienen BenjaminBrienen linked a pull request Dec 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
1 participant