I’ve never worked with this feature before but is the vibration mechanism supposed to only work for 7 seconds at a time.
My understand was that you send the vibration information to the controller, which then applies the correct amount of speed to the motors until the the API sends another speed (like 0 to stop both). This works but I find it odd that after a certain amount of time the motors will stop on their own and resume after a few seconds before eventually stopping completely.
Is this how this feature is supposed to work?
The API does not let you control the speed of the motor, you can only set it ON/OFF.
You send the duration you want the motor to stay ON. After that time the motor turns OFF automatically.
For a better effect you have to use PWM/duty-cicle.
Here’s a helper class to do that. https://github.com/tainicom/XNALibrary/blob/master/Source/Devices/Vibrator.cs
You have to call Vibrator.Current.Update() on every frame.
Set Vibrator.Current.Dumping somewhere between 0.7-0.95 so it will stop after a while.
Call Vibrator.Current.Vibe(power) whenever you have a collision, explosion, bullet-hit, button tap, etc. power is between 0.0 - 1.0.
Note: (1) This kind of feed-back will mess with the accelerometer readings.
(2) Some devices have weak motors, while on others are more noticeable. Let the user adjust Vibrator.Current.MasterPower from the settings.
Your example applies to mobile devices. I’m talking about using a controller on a Desktop project.
You mean on gamepads?
In that case no, I haven’t looked into that API.
I guess the motor will turn off after a while as a protection mechanism of overheating/burning.
If that’s what you are asking…
I see, well that makes sense then. Thank you.
Well, It sounds possible but then again I am not an expert on GamePads.
It’s good if someone else could confirm it.
Which desktop project are you using?
Universal (openGL) or Windows (DirectX/XInput) ?
I’m using DirectX right now.