![]() I discovered you need to write an Output Report to the device (see HidDevice for the method and DS4Device for the magic numbers) in order to coax it into sending motion data. No motion sensor data when connected via Bluetooth. This silly procedure seems to work around that on Windows 7. ![]() I found two problems extending this to work wirelessly (and two solutions):ĭualShock 4s don't like to stay paired to Windows (prior to Windows 8). It's a right-handed coordinate system with x+ right, y+ up, and z+ pointing toward the player.įetching the data this way doesn't interfere with Unity's InputManager, which will still pick up the buttons & sticks as expected, without needing to download non-standard drivers or run extra software in the background. A little empirical testing and it looks like this gets the data into gs and radians/sec: accel = new Vector3( This guide told me where to find the motion sensor data within the 64-byte report. I cut out the rest to keep things as simple as possible - I've just got a thread polling for new data as fast as it can.) (That's the NativeMethods class to interface with Kernel32.dll, the device enumeration from HidDevices, and reading the report from the HidDevice class. I grabbed the DS4Tool source and copied the bits I needed into my Unity project so I could read the reports from the device directly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |