bevy/crates/bevy_input/src
Johan Klokkhammer Helsing a1e442cd2a
Add gamepad rumble support to bevy_input (#8398)
# Objective

Provide the ability to trigger controller rumbling (force-feedback) with
a cross-platform API.

## Solution

This adds the `GamepadRumbleRequest` event to `bevy_input` and adds a
system in `bevy_gilrs` to read them and rumble controllers accordingly.

It's a relatively primitive API with a `duration` in seconds and
`GamepadRumbleIntensity` with values for the weak and strong gamepad
motors. It's is an almost 1-to-1 mapping to platform APIs. Some
platforms refer to these motors as left and right, and low frequency and
high frequency, but by convention, they're usually the same.

I used #3868 as a starting point, updated to main, removed the low-level
gilrs effect API, and moved the requests to `bevy_input` and exposed the
strong and weak intensities.

I intend this to hopefully be a non-controversial cross-platform
starting point we can build upon to eventually support more fine-grained
control (closer to the gilrs effect API)

---

## Changelog

### Added

- Gamepads can now be rumbled by sending the `GamepadRumbleRequest`
event.

---------

Co-authored-by: Nicola Papale <nico@nicopap.ch>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
Co-authored-by: Bruce Reif (Buswolley) <bruce.reif@dynata.com>
2023-04-24 15:28:53 +00:00
..
axis.rs add Axis::devices to get all the input devices (#5400) 2023-01-06 18:00:22 +00:00
common_conditions.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
gamepad.rs Add gamepad rumble support to bevy_input (#8398) 2023-04-24 15:28:53 +00:00
input.rs Rename schedule v3 to schedule (#7519) 2023-02-06 18:44:40 +00:00
keyboard.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
lib.rs Add gamepad rumble support to bevy_input (#8398) 2023-04-24 15:28:53 +00:00
mouse.rs Added Ref to allow immutable access with change detection (#7097) 2023-01-11 15:41:54 +00:00
touch.rs Non-breaking change* from UK spellings to US (#8291) 2023-04-08 16:22:46 +00:00