Leafwing-Studios / leafwing-input-manager

A straightforward stateful input manager for the Bevy game engine.
Apache License 2.0
721 stars 109 forks source link

ActionState<A>::value can no longer, since version 0.15.0, be used to query for value of triggers. #585

Closed Invisible-Rabbit-Hunter closed 2 months ago

Invisible-Rabbit-Hunter commented 3 months ago

Version

0.15.0

Operating system & version

Fedora 40 Workstation

What you did

Defining an action Action::A to be an InputControlKind::Button, I tried to query its value using action_state.value(&Action::A).

What you expected to happen

The program reads the trigger value, as is supposed to be shown in the example axis_inputs.

What actually happened

The program crashes with an assertion error, as Action::input_control_kind(&Action::A) != InputControlKind::Axis.

Additional information

Note that ActionState::value has the assertion that Action::input_control_kind(&Action::A) == InputControlKind::Axis (see this line), which is clearly false for the defined action. Note that the example axis_inputs also crashes on the main branch (as of Thursday, 8th of August 2024) for the exact same reason, and thus should work as a reproducible example.

alice-i-cecile commented 3 months ago

IMO the fix here is #551 :)

Invisible-Rabbit-Hunter commented 3 months ago

I actually just noticed that the axis_inputs example fails even earlier, due to a similar issue, where ActionState::pressed is used for both InputControlKind::DualAxis and InputControlKind::Axis, which causes an assertion to fail.