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

Add gamepad trigger press values. #681

Closed
wants to merge 1 commit into from
Closed

Conversation

bhickey
Copy link

@bhickey bhickey commented Oct 14, 2020

This fixes #680.

@Moxinilian Moxinilian added C-Feature A new feature, making something new possible A-Input Player input via keyboard, mouse, gamepad, and more labels Oct 14, 2020
@cart
Copy link
Member

cart commented Oct 14, 2020

I think this is a good addition, but I think its worth ensuring this is a good "general purpose" api and not just something for gamepad buttons.

Some questions to answer:

  • should we be setting value to 1.0 when a key is pressed and 0.0 when a key is released?
  • if so, should value be the "source of truth" for the "pressed" value? Ex: the "press" state is directly derived from the "value". This could be expanded to allow for configurable "thresholds" (aka: pressed is only set when value is between 0.5 and 1.0)
  • Should such an api be implemented at a higher level? ex: something like bevy_input_map

@simpuid
Copy link
Contributor

simpuid commented Oct 15, 2020

No one is stopping us from using Axis<GamepadButton> resource. But still this is also a valid approach.

should we be setting value to 1.0 when a key is pressed and 0.0 when a key is released?

Key state is derived from these values not the other way around. And the range could be -1.0 to 1.0 instead of 0.0 to 1.0 as it was in my case, that's why the plugin queries the gamepad for default values of axes on connect event.

if so, should value be the "source of truth" for the "pressed" value? Ex: the "press" state is directly derived from the "value". This could be expanded to allow for configurable "thresholds" (aka: pressed is only set when value is between 0.5 and 1.0)

GilrsBuilder supports this but only at initialization. We can implement our own filters at bevy_gilrs level and that can be updated the way we want.

Should such an api be implemented at a higher level? ex: something like bevy_input_map

I don't think so, because Input<GamepadButton> should work without bevy_input_map plugin and we need these values for proper functioning.

@bhickey
Copy link
Author

bhickey commented Oct 15, 2020

Closing in favor of #683

@bhickey bhickey closed this Oct 15, 2020
@simpuid simpuid mentioned this pull request Oct 15, 2020
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-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GamepadButton does not retain trigger values
5 participants