I am attempting to access the accelerometer and gyroscope functionality of the dualshock 4 controller for implementation into Unity.

DMGregory seems to have found a solution to this problem, my question is how he succeeded in getting the motion input working here.

He mentions that he reached his solution by grabbing the DS4Tool source and copying parts of the files: NativeMethods, HidDevices and HidDevice

I understand a lot of what is happening here, I just do not have the coding chops to get it working. I believe I should be "using NativeMethods" but do not fully understand how to access the read report to retrieve the necessary data.

Any help is greatly appreciated!

  • \$\begingroup\$ Generally you want to comment on an answer asking for clarification if some aspect of that answer isn't clear to you, or you need additional details; don't re-ask the question. Since you cannot comment on answers that aren't your own yet, I've done so for you. \$\endgroup\$
    – user1430
    Commented May 12, 2016 at 20:28
  • \$\begingroup\$ Alternatively, if you are having a specific issue such as a compiler error or specific runtime error, you can update your post to include that clarifying information so that it's not just a repeat of an existing question; you have to be specific though, as "I don't know how to make it work" is too broad. \$\endgroup\$
    – user1430
    Commented May 12, 2016 at 20:30
  • \$\begingroup\$ Thank you, sorry for the repost, I had attempted to comment but this seemed to be my only option \$\endgroup\$ Commented May 12, 2016 at 20:35
  • \$\begingroup\$ Sorry that answer was a bit light — I was still finding my StackExchange groove two yeara ago. ;) I'll expand it a bit further soon (travelling just now). If you ever need to reach me for more info on an answer, you can also tweet @D_M_Gregory \$\endgroup\$
    – DMGregory
    Commented May 13, 2016 at 9:37


Browse other questions tagged .