PSMove as a light gun via mouse emulation

Issue #14 new
Tom W created an issue


First off, this is not a issue, but I am not sure where else to discuss PSMoveFreepieBridge.

Also, big thanks for your work, reusing old hardware is always great thing to do.

I am trying to use my PSMoves as lightguns via mouse emulation for use in games (emulators mainly). Other light gun options arent that great and I think that the psmove could make a good one due to its accuracy (plus the abundance of gun style cases). I have PSMoveService, PSMoveFreepieBridge and FreePIE working (1x psmove, ps3eyecamera and no nav controller), and I am able to use the psmove as a mouse, but the movement is not relative to where I am pointing the psmove - if I move the controller from center to the edge of the tv the cursor will only move a fraction of that distance.

Which leads me to my question - Is there any way to configure the psmove as a 1:1 pointing device? (not sure if thats the right term, but I want to have the mouse at the location where the psmove is pointing at the tv... hope that makes sense)

Thanks again. Any help is greatly appreciated

Comments (13)

  1. Elliot Hawkins repo owner

    This should definitely be possible. It looks like FreePIE can be used to set an absolute mouse position, as discussed in this forum thread:

    Specifically, the last post includes some example code to set the mouse position to an exact location. So, instead of setting the mouse deltas with the yaw and pitch in the python script, you could use this to set the absolute position based on actual position data from the controller.

    You probably don't want to use the controller position as-is, since the coordinates of your PS Move bounds likely don't match with the monitor. Scaling alone might be good enough if you had the right value and didn't mind keeping your controller relatively centered. If you wanted something that could be moved around more freely with pointing, you'll need to factor in the controller rotation.

    Hopefully that points you in the right direction.

  2. Jordan Woodard

    Hello! I'm currently interested in this topic, for much of the same purpose as OP. I've tried using things such as Wiimotes to emulate light gun movement using mouse>>gun emulation, but was far too spotty. The Playstation Move controller on the otherhand seems as if it fairs better. Attached is a video testing this notion with me playing House of The Dead on the Sega Model 2 emulator. Works well enough, except, for whatever reason the X yaw keeps moving to the left and the centering of the cursor is constantly thrown off as a result. Would you know of any way to fix/prevent this from happening? Thank you for the work you've done, it's truly fantastic.

    House of The Dead/w PS Move

  3. Tom W reporter

    @Elliot I tried the script you linked, and it does work (the author is correct, it is possibly the most annoying script in the world :)). I have tried to incorporate it into the FreePieBridge script, but I'm not able to get it working. Do you have any more pointers you could offer?

    @jordan Wow, that looks really awesome. I didnt see any jitter towards the edges which is a big issue with a wiimote. Do you mind sharing your setup and any other relevant info?

  4. Jordan Woodard


    Thank you! It was far better than any wiimote>>ir mouse script, and tons more accurate.

    I run an AMD 380x/w 16 GB of DDR3 Ram, and an i7 3770k

    The programs running in the background are the PSMoveService both for configuration/calibration, and for feeding data to the PSMoveBridge which then in turn feeds data to the example mouse script running in FreePIE. It works well enough, and I can center it somewhat for a decent calibration, but as stated, the x yaw (I use mouse tracking with gyroscope) constantly moves to the right, no matter what. The y pitch shakes up and down a bit, but it's so nelegiable that it doesn't really factor into calibration. If it's of any importance this was done on a 1920x1080 40" Sony Bravia with a refresh rate of 59 Hz

    This is my config for gyroscopic movement, it tracks pretty much perfectly

    #Mouse movement using Gryoscope
    mouse.deltaX = -7 * freePieIO[1].yaw
    mouse.deltaY = -7 * freePieIO[1].pitch
    lastX = 0
    lastY = 0
  5. Tom W reporter

    Thanks for the info Jordan. Did you make any modifications to the freepie script? I used that script too, but I get the results described in my first post - to move the cursor to the edge of the screen I would need to move the move, turn it upside down and move it again. I would need to repeat this several times to get to the edge.

  6. Tom W reporter

    Hey Jordan, I tried with your modifications above and now it works similar to whats in your video, but I get a wiggly drift upwards on the y axis :( Some points I noticed:

    Moving the controller far off screen causes the center point to be out when returning to pointing at the screen. I dont think the pseye is being used? I can cover the glowing ball and the psmove still moves the mouse cursor. Have you tried with positional tracking? I dont get any movement when commenting out the mouse movement section and uncommenting the positional tracking section. Maybe the camera would help with drift and alignment of the move and mouse cursor?

    I have started a thread at the mtbs3d freepie forum asking for help as I feel that this is possibly more of a freepie script issue

  7. Jordan Woodard

    @teeedubb Hello! Yeah sorry for the long wait time, I have been super duper sick over the past two days, aha. I see, yeah the drifting is honestly one of the most annoying things ever, since it ALMOST works so damn perfectly. I mean, when I tried configuring the PlayStation Eye in the PSMoveConfig Service, the eye seemed to have tracked properly, but I'm not exactly sure as to why the script may not be received the much needed data for positional tracking. I had a hunch that maybe the "last.x last.y" lines had something to do with it? I mean, those lines I believe are serving as an active updater as to where the cursor last was, and both are set to 0, so maybe that has something to do with it? Not sure. I am not sure how the script would go about tethering to the Eye's data, but that would be useful. A friend of mine who programs in C++ noted that it may possibly be a hardware issue.

  8. William Groom

    Hi @vssefan and @teeedubb,

    Yaw drift is something most orientation sensors have a problem with. The PSMove controllers deal with it by using the magnetometer. This is done in the orientation filter of PSMoveService. Assuming that PSMoveFreepieBridge hooks into PSMoveService correctly, then calibrating the magnetometer should minimise the drift.

  9. Tom W reporter

    Hi guys,

    Sorry about the late reply... been busy with other stuff. Is it possible to eliminate drift completely with the PSMove controller? I very carefully re-calibrated the controller, and while it has significantly reduced drift, it is still there.

  10. CaptainReek

    hey @teeedubb

    I started playing with the script and I figured out how to eliminate the drift:

    #Mouse movement using Gryoscope
        if -4*freePieIO[1].yaw <= 0.09 and -4*freePieIO[1].yaw >= -0.09:
            mouse.deltaX = 0
            mouse.deltaX = -4*freePieIO[1].yaw + 0.057
        if -4*freePieIO[1].pitch >= 0.001 and -4*freePieIO[1].pitch <= -0.9:
            mouse.deltaY = 0
            mouse.deltaY = -4*freePieIO[1].pitch +0.756

    if you offset the deltaY and deltaX with a small decimal value to reduce the drift to just a small random jitter of the cursor, you can create a small deadzone using the if statements to keep it completely steady.

    You can adjust the "-4" to get the sensitivity you require, but you'd have to play with the offset values and deadzone limits.

    As for the positional tracking, it looks like it is commented at earlier in the code:

    #Mouse movement using position data
        #mouse.deltaX = (freePieIO[0].x - lastX) * cursorScale
        #mouse.deltaY = -1 * (freePieIO[0].y - lastY) * cursorScale
        #lastX = freePieIO[0].x
        #lastY = freePieIO[0].y

    I'm not sure how I'd change it to get a more accurate representation of the movement, maybe some relationship between yaw/pitch and x/y position?

  11. Thiago Sonda

    Guys I need help, I know this is a one year past topic, but i need some help with the usage of a psmove like a lightgun on shooting games in emus/game loader, like mame or teknoparrot. I configured the move control as a mouse using psmoveservice, psmovefreepie bridge and free pie, on Windows/Desktop works like a charm, but when i go to the game the mouse input doesn't work (mame) or even when i open the loader (teknoparrot) it seems the script from frepie is blocked/stoped.... Any hint of what is happening?

    Sorry for "Engrish", I'm from Brazil....

    Thanx Thiago

  12. Log in to comment