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