Button data is typically binary, but is treated as if it were continuous #3398
Labels
A-Input
Player input via keyboard, mouse, gamepad, and more
C-Code-Quality
A section of code that is hard to understand or change
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Button data often cannot be analogue, it is etiher exactly 0.0 or 1.0 (at least, when returned by
gilrs
). See the investigation in #3246 (comment).However, we return a
f32
, which is always (at least, when usinggilrs
) either exactly 0.0 or 1.0.Moreover, we have an often useless
ButtonSettings
struct, which thresholds these returned values in a configurable way, and converts them back into a bool.Finally, our official example demonstrates that we should be using
Axis
for gamepad triggers, which is semantically wrong.What solution would you like?
Axis
: seebevy/examples/input/gamepad_input.rs
Line 23 in 3409579
What alternative(s) have you considered?
ButtonSettings
completely.bool
as soon as we receive it fromgilrs
.I would probably prefer a
as our representation oif this data, but even a
bool
would be significantly better than our currentf32
.This solution is not as good as the above, as it is not standards compliant and doesn't handle triggers nicely (they're clearly buttons, not axes).
Additional context
Identified in #3246.
The text was updated successfully, but these errors were encountered: