GamePad.SetVibration Method

Sets the vibration motor speeds on an Xbox 360 Controller.

Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public static bool SetVibration (
         PlayerIndex playerIndex,
         float leftMotor,
         float rightMotor


Type: PlayerIndex
Player index that identifies the controller to set.
Type: Single
The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
Type: Single
The speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.

Return Value

true if the vibration motors were successfully set; false if the controller was unable to process the request.

Exception typeCondition
InvalidOperationException An unknown error has occurred. Verify that the correct playerIndex is being requested.

If this method returns false, it means that the controller is either disconnected or too busy to accept the new vibration settings. It is not advisable to loop in wait for this method to return true.

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone

Community Additions