I'm trying to get the Hydra to act like a lightgun and want to put the mouse cursor where the hydra is facing on the screen, but with freepie I can just set the deltax/y.
I'm didn't read into python and its librarys, but it seems that I can't find a easy solution to do that.
Absolute Mouse Position
-
- Golden Eyed Wiseman! (or woman!)
- Posts: 1498
- Joined: Fri Jul 08, 2011 11:47 pm
Re: Absolute Mouse Position
You could easily use Hydra in mouse mode to APPROXIMATE this. However, since there is no calibration between the Hydra and your screen distance, the chance that the Hydra would exactly line up with the cursor, and stay there if you moved around, forwards/backwards, etc, is pretty non existent.
Do you really need the Hydra to 'point' at the cursor, or do you just want absolute mouse control by moving the Hydra around within a box sized area?
Do you really need the Hydra to 'point' at the cursor, or do you just want absolute mouse control by moving the Hydra around within a box sized area?
- Ryukra
- One Eyed Hopeful
- Posts: 5
- Joined: Tue Apr 16, 2013 7:25 pm
Re: Absolute Mouse Position
I want to calculate the intersectingpoint from the pointingdirection of the hydra with the screen.
I have the screendimensions and the position relative to the base station.
I-x--------I Screen
....\
.....\ O Base
......\
.......\\ Hydra
I have the screendimensions and the position relative to the base station.
I-x--------I Screen
....\
.....\ O Base
......\
.......\\ Hydra
-
- Certif-Eyed!
- Posts: 661
- Joined: Sun Mar 25, 2012 12:33 pm
Re: Absolute Mouse Position
Huh, you can do absolute mouse position in Java with the awt.robot library...But I don't know if you can get FreePIE to interface like that.
- baggyg
- Vireio Perception Developer
- Posts: 491
- Joined: Sat May 19, 2012 5:20 am
- Location: BB, Slovakia
Re: Absolute Mouse Position
I looked at the mousePlugin recently on freePIE. It is not possible to get/set the absolute position of the mouse. Currently the DLL (user32.dll) call can only send mouse movements not positions. What may be possible is to work out everything in your python script and then devise the mouse movement needed to get to that point.
You will need to keep a running X.Y point and compare that to an extrapolated X/Y point of your hydra. Then devise the movement and pass that to your mouse.
I.e
Previous XY was (100,100)
extrapolated new position should be (110,92)
send values of
deltaY = -8
deltaX = 10
Theoretically this should work. You would have to figure out the range you want in terms of Hydra movement and of course this would differ dependant on distance to the screen ratio to base station etc however you could build these in as initial variables.
Good luck
You will need to keep a running X.Y point and compare that to an extrapolated X/Y point of your hydra. Then devise the movement and pass that to your mouse.
I.e
Previous XY was (100,100)
extrapolated new position should be (110,92)
send values of
deltaY = -8
deltaX = 10
Theoretically this should work. You would have to figure out the range you want in terms of Hydra movement and of course this would differ dependant on distance to the screen ratio to base station etc however you could build these in as initial variables.
Good luck
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: Absolute Mouse Position
When I get time i can fix so that we also support
Code: Select all
MOUSEEVENTF_ABSOLUTE = 0x8000;
-
- One Eyed Hopeful
- Posts: 19
- Joined: Mon Jun 15, 2015 10:30 am
Re: Absolute Mouse Position
Sorry ot necro, but it is relevant.
This works in FreePIE, stock:
Now, that example is possibly the most annoying thing ever written, so change your logic as needed.
Cheers
This works in FreePIE, stock:
Code: Select all
import ctypes
if(mouse.getPressed(0)):
ctypes.windll.user32.SetCursorPos(100, 20)
Cheers