JibbSmart / JoyShockLibrary

Read DualSense, DualShock 4, JoyCon, and Pro Controller input on PC -- compiled for Windows, but code should work on other platforms.
Other
226 stars 42 forks source link

Joycon MOTION_STATE quat values are INSANE #53

Closed AndrewHamel111 closed 1 year ago

AndrewHamel111 commented 1 year ago

There's a couple specific orientations I can hold the joycon at and the values seem to stabilize, but most of the time the values are flying all over the [-1,1] range and it's clear that there's an issue. While the joycon sat flat on my desk, this is the log of the quatX -> quatW if I poll the controller 30 times a second: image Using SetAutomaticCalibration or even using the Continuous Calibration doesn't have any impact on smoothing these values. The offset returned by JslGetCalibrationOffset in either case is as follows: **-22.57 -12.71 -40.07**

When testing with a DualSense, the quat behaves much more normally so long as the controller is pretty much buttons-facing-up. Once you tilt the controller so the buttons face you, the spazzing resumes. At least when calibrating the controller, it properly resets the quat such that my example model running in Raylib is oriented properly. With the DualSense there seems to be a range in which you could almost use these values for something, and that range is one of the most common ones a player would hold the controller in, but for the joycon that weird angle where it does stop spamming is very awkward and most of the time doesn't even work. If it sounds like I'm not using the values properly, we can do some other tests and talk about that but at this point I don't have faith that the quat values are really working properly.

JibbSmart commented 1 year ago

Sorry about that. It was an error in GamepadMotionHelpers that I hadn't picked up on because I always use Gyro and Gravity directly rather than Quat. It should be fixed now. Please re-open this if the issue persists with the new version. https://github.com/JibbSmart/JoyShockLibrary/releases/tag/v2.2.1