@@ -15,13 +15,42 @@ Since our last release a few months ago we've added a _ton_ of new features, bug
15
15
16
16
<!-- more -->
17
17
18
- * ** Feature** : description
19
-
20
- ## Feature
21
-
22
- <div class =" release-feature-authors " >authors: @todo</div >
23
-
24
- Description
18
+ * ** Gamepad Rumble API** : an ECS-friendly way of making controllers rumble
19
+
20
+ ## Gamepad Rumble API
21
+
22
+ <div class =" release-feature-authors " >authors: @johanhelsing, @nicopap</div >
23
+
24
+ You can now use the ` EventWriter<GamepadRumbleRequest> ` system parameter to
25
+ trigger controllers force-feedback motors.
26
+
27
+ [ ` gilrs ` ] , the crate bevy uses for gamepad support, allows controlling
28
+ force-feedback motors. Sadly, there were no easy way of accessing the
29
+ force-feedback API in bevy without tedious bookkeeping.
30
+
31
+ Now bevy has the ` GamepadRumbleRequest ` event to do just that.
32
+
33
+ ``` rust
34
+ fn rumble_system (
35
+ gamepads : Res <Gamepads >,
36
+ mut rumble_requests : EventWriter <GamepadRumbleRequest >,
37
+ ) {
38
+ for gamepad in gamepads . iter () {
39
+ rumble_requests . send (GamepadRumbleRequest :: Add {
40
+ gamepad ,
41
+ duration : Duration :: from_secs (5 ),
42
+ intensity : GamepadRumbleIntensity :: MAX ,
43
+ });
44
+ }
45
+ }
46
+ ```
47
+
48
+ The ` GamepadRumbleRequest::Add ` event triggers a force-feedback motor,
49
+ controlling how long the vibration should last, the motor to activate,
50
+ and the vibration strength. ` GamepadRumbleRequest::Stop ` immediately stops all
51
+ motors.
52
+
53
+ [ `gilrs` ] : https://crates.io/crates/gilrs
25
54
26
55
## <a name =" what-s-next " ></a >What's Next?
27
56
0 commit comments