Open Cedev opened 1 month ago
After
~/.cargo/git/checkouts/leafwing-input-manager-85f1d55581648fda/54a361b$ git log
commit 54a361bde6f548e33b4a0491c03d2fa759f5c6cd (HEAD -> master)
Author: Shute <sinoctis@163.com>
Date: Wed Oct 16 17:49:52 2024 +0100
Add `value` for button-like inputs (#649)
Sorry, should have used the git hash. I guess I shouldn't trust Cargo.toml
after cargo add --git
.
Version
54a361b
Operating system & version
Debian 12
What you did
Added a throttle button using the right analog trigger on a gamepad, and with a custom
Axislike
that reads the same thing from theCentralInputStore
.Into an input map for this
Actionlike
Read the value from both the button and the custom axislike, while printing out all of the
GamepadEvent
s that are receivedThe custom
Axislike
reads from theCentralInputStore
.What you expected to happen
The throttle value to change over the entire range from
0.0
to1.0
as the analog stick was depressedWhat actually happened
Although
GamepadEvent
s are emitted smoothly over depressing the analog stick, reading the value from the button only ever returns1.0
(or0.0
) and reading the value from theCentralInputStore
only returns high values over about0.75
(or0.0
).Additional information
The
UpdatableInput
implementation forGamepadButton
only records the axis values for buttons that are eitherpressed
orjust_released
https://github.com/Leafwing-Studios/leafwing-input-manager/blob/54a361bde6f548e33b4a0491c03d2fa759f5c6cd/src/user_input/gamepad.rs#L570-L587
I don't know why
ActionState<>::button_value
andActionState<>::clamped_button_value
only return1.0
or0.0
even though they are documented as returning analog values inexamples/axis_input.rs
:https://github.com/Leafwing-Studios/leafwing-input-manager/blob/54a361bde6f548e33b4a0491c03d2fa759f5c6cd/examples/axis_inputs.rs#L63-L65