how to make the Playstation 3 controller vibrate?

I am fiddeling around with the playstation3 controller on the pc, and I was wondering if it is possible to make it vibrate, when you for example shoot?.
just a simple code snippit will do :slight_smile:


not sure if this has been changed since I was messing with it… used to be you need to drop in XInput to your project…

LOL not sure that was much of an answer to the actual question (but someone thinks so)… Also, I just noticed you were asking about Playstation, I was actually thinking XBOX…
for Playstation controllers, it would be different… I have never actually tried connecting PS3 controllers to my PC, but I will try now… I will update this answer shortly. :wink:


OK, turns out my answer is not so far off after all-

The only way I have found to successfully use the PS3 controller on the PC is using motionjoy… Am I correct in assuming this is how you are getting this to work?

Assuming so, the options of this driver/emulator allow for several choices… For most games, XBOX 360 is the best choice, since most games support this…

In which case, normal Xinput vibration commands will work… The XInput Unity folder contains a .dll and an Assets and Library folder (sound familiar?)

just copy everything into your project folder, and let it overwrite everything… As I recall this will destroy all your Input settings, you will need to redo all of your Input Manager stuff…

The Xinput files include a sample scene which accesses the two vibration motors via the triggers… From there, you must figure out how to properly access the vibration using the sample script as an example. Last time I tried I never figured it out all the way, as seen here:

I think looking back at it now, probably my mistake is using the Update function, maybe it just needs to be set once… But I’ve come a long way since then, maybe I’ll have better luck this time… I will play with it now, and then update one more time…

(for now, I have definitely confirmed that the method described above does work)

FINAL UPDATE:::::::::::::::::::::::::::::::::::::::::::::::::

well, not sure what was going wrong last time, something to do with the PlayerIndex part I guess… anyway, seems straightforward enough now… Here is a sample script:

function Update () {

var left = 0;
var right = 0;
left = 1;
right = 1;

        XInputDotNetPure.GamePad.SetVibration(0, left, right);

(I use 0 as the player index, this is controller 1. Controller 2 would be 1, I believe, as in: XInputDotNetPure.GamePad.SetVibration(1, left, right); … etc)

this should give you the idea…