XNA Game Studio 3.1
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)

Syntax

C#
public static bool SetVibration (
         PlayerIndex playerIndex,
         float leftMotor,
         float rightMotor
)

Parameters

playerIndex
Player index that identifies the controller to set.
leftMotor
The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor
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.
Exceptions

Exception typeCondition
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.

See Also

Tasks

Reference

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune
Tags :


Page view tracker