How to set the duration for Xbox One controller vibration?

I am using XInput as that seems to be the only way to set up vibration for Xbox controllers and it’s simple enough to get some vibration working, however I have two issues:

GamePad.SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor); SetVibration takes a value for each of the two motors, but if I set the left to one and the right to zero the controller is much stronger than the other way around (the left motor is much stronger than the right).

And more importantly the controller vibrates for ~2 seconds when I only call VibrateController once. This obviously makes the rumble pretty useless, so is there something I’m missing to make it vibrate for a much shorter time?

Hi, better late than never.

The solution is quite simple.

Just set the vibration to 0 when you want it to end.

GamePad.SetVibration(PlayerIndex.One, 0, 0);

Based on that you can fade out the vibration in time or react to the input of an axis.

1 Like