-
Notifications
You must be signed in to change notification settings - Fork 808
Using gyro & accelerometer to control analog stick #1183
Comments
I've actually managed to hack the code to get this to work. It woirks perfectly - multiple DS4 gamepads each acting as a lightgun. Let me know if you'd like to see the code. Cheers. |
I would love to see it, I am looking for a solution to read the accelerometer and was about to dig into the code. |
Normal LS/RS/L2/R2/SixaxisX/SixaxisZ (axis config tab) has a custom output curve option to smooth the output curve. That "custom" option of those axies use bezier curve formula to support pretty much any smoothing you want. "Gyro" tabpage supports mapping gyro to LS/RS axies (tilt left/right/up/down), but it is true that it doesn't support any kind of smoothing. I think that "gyro as LS/RS stick X/Y axis" mapping might benefit from the custom bezier curve support because it would support any smoothing pattern. "Gyro Mouse" and "Gyro Mouse Joystick" does have smoothing logic but some part of it is hard-wired in the code. Bezier custom curve option might be useful there. Hmmm.... What you described as a "lightgun" device using gyro in LS/RS sticks with proper smoothing (and optionally "reset to center" trigger button) indeed sounds great. "Mame lightgun" use case certainly isn't the only case where it might be useful. |
Thanks, mika. Like I said - I've actually cracked it. I've got the code ready to go. I was hoping the author may have seen this and reached out. To be fair - I'm pretty useless with git and pull requests etc so I'm not doing myself any favours. But yeah - it works. And much better than I'd hoped for. |
Code submitted. Added a pull request. Fingers crossed :) |
Code submitted where? Don't see any pull requests? |
I don't know why... but it seems I keep getting loinked back to the old DS Windows project? |
The uplink of the fork you have is based on Jays2Kings repository, not Rycohan7 repository. Anyway. I took a quick look at the code and the code probably won't be accepted just like that into the official repository because there are some nasty hard-wired things (axis, profile name etc). But the idea behind the code is good. It might be best to integrate this functionality into "Gyro as Joystick" config screen with the following options:
Let's see if I find time to do this at some point, but feel free to contribute and fine-tune the patch :-) |
An additional config option for that section which I would love to have if it's fairly simple would be... "Read from accelerometer instead of gyro" or something along those lines. Really just any way to map the accelerometer to something. My current plan is to make a little program to read the accel values from the UDP server, should I just keep working on that instead? |
@mika-n. Thanks for checking it out. It is hard wired to R analog. Ideally it would be switchable to left analog as well. But I deliberately made the call to prefer readable code with minimal disruption. It is the same with forcing recenter to happen on X button press only. And yes - functionality is dpendent on a profile being named 'Lightgun'. But this is also intentional - Ryo can test this easily and see the scope of what is affected. This patch won't go straight into the main fork. But it shows what can be done with just a dozen lines of code and is INCREDIBLY powerful (multiplayer lightgun games. wow). I feel I can only take a horse to water here... it works and is a game changer. Your suggestion of auto-recentering based on hyro is genius, by the way. A great idea. |
@bluechipps I managed to set this up using DS4Windows and vJoy. What do you need it for? (Might be worth starting a new feature thread). |
You hit the wrong @mika-n |
Sorry! |
@midget35 did you talk about this problem? https://youtu.be/5h6cP4P7BeQ |
Yep. Submitted a proof-of-concept fix. Works great. |
@midget35 and we can throw off the finished .EXE file I do not understand anything in programming, спасибо. |
I've been impressed at how well the DS4 gyro maps to mouse cursor movement when setup through your app. There is no noticable delay or jitter, and it is extremely responsive. It offers great lightgun support in MAME.
Unfortunately, I have not found the 'Mouse joystick' option to be as as smooth. I have played with all the settings but it is extremely jumpy. Is it possible to get the same gyro smoothness of control as we get when commandeering the mouse? (Also, the horizontal axis does not map the same way as it does for the mouse, so that would be a great feature).
It would be a great result to have the analog stick control like the mouse when mapped to an analog stick. It would allow multiplayer lightgun games to be played via additional DS4 controllers. It would also be really cool if one could map a 're-center' action to a button so the analogue controlled cursor jumps straight back to the center of the screen when pressed. Finally - being able to map 'Mouse control' to both the left and right analog sticks would be really handy.
Thanks for your great work :)
The text was updated successfully, but these errors were encountered: