GamePad.SetVibration Method
Sets the vibration motor speeds on an Xbox 360 Controller.
Syntax
'Declaration
Public Shared Function SetVibration ( _
playerIndex As PlayerIndex, _
leftMotor As Single, _
rightMotor As Single _
) As Boolean
public static bool SetVibration (
PlayerIndex playerIndex,
float leftMotor,
float rightMotor
)
public:
static bool SetVibration(
PlayerIndex playerIndex,
float leftMotor,
float rightMotor
)
Parameters
- playerIndex
Type: PlayerIndex
Player index that identifies the controller to set. - leftMotor
Type: Single
The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor. - rightMotor
Type: Single
The speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Return Value
Type: Boolean
true if the vibration motors were successfully set; false if the controller was unable to process the request.
Exceptions
Exception type | Condition |
---|---|
InvalidOperationException | An unknown error has occurred. Verify that the correct playerIndex is being requested. |
Remarks
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.
Requirements
Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
GamePad Class
GamePad Members
Microsoft.Xna.Framework.Input Namespace
Platforms
Windows Phone