PDA

View Full Version : Can mouse be mapped to recenter with joystick?



JAF
19th June 2004, 12:40 AM
I have been trying to figure out how to write a script that will set up the mouse to track joystick position. In other words, when the stick is moved on the x-axis, the mouse follows AND returns to center when the joystick is moved back to center. The basic mouse mapping in the GUI doesn't do this - once the mouse moves, if you move the joystick back to center it stays off-center.

I have built the basic sample scripts, and they make sense, but I can't see how to address the mouse in a script. I guess I would assume that I'd do something like

When axis value changes
Set mouse position to match new axis position

This way the mouse position would follow the deflection amount on the stick?

Any and all thoughts on how to do this would be welcomed.

Thanks,

Joel

Bob Church
19th June 2004, 03:13 AM
>>
When axis value changes
Set mouse position to match new axis position
<<

There&#39;s the problem. You have no way of knowing where the mouse cursor is. If you knew that, then, like you say, it would mainly be a matter of assigning the mouse X and Y to a couple of CMS axes and feeding them the difference between the stick position and the mouse position. It would eventually drag the mouse position onto the stick position and the difference would go to zero. If you don&#39;t know where the mouse is, though, you can&#39;t know which way to move it or when it got to the joystick position. You&#39;re just sort of flying blind.

- Bob

The StickWorks
http://www.stickworks.com

MichaelCHProd
20th June 2004, 01:43 AM
Bob what if he programmed the mouse axis to return to the center of the screen when his stick is at 128, 128 or there abouts?

Say the GUI shows CMS.A1 as Mouse X and CMS.A2 as Mouse Y with JS1.A1 as nothing and JS1.A2 as nothing as well.

Couldn&#39;t he check his screen resolution and half it (1024x768 would be 512x384) then write something like...

IF JS1.A1 = 128 THEN
CMS.A1 = 512;
ENDIF

IF JS1.A2 = 128 THEN
CMS.A2 = 384;
ENDIF

Of course he would want to open up a dead zone at 128,128 so he could always get a return to center.

Or am I way off :drunk:

Bob Church
20th June 2004, 04:51 AM
It does sound like something that should be easy but I just don&#39;t see any good way. You&#39;d have to scale things so the screen looked to be 255x255 and limit the CMS.A1 and CMS.A2 values to that, but even so they only set velocity. Unless you know the position now, you can&#39;t really tell which way to move or how far it needs to go. You know you want to go to 512, 384. You just don&#39;t know if you&#39;re at 1024,768 or 0,0 or somewhere in between.

- Bob

The StickWorks
http://www.stickworks.com

JAF
20th June 2004, 08:46 AM
Originally posted by Bob Church@Jun 20 2004, 03:51 AM
It does sound like something that should be easy but I just don&#39;t see any good way. You&#39;d have to scale things so the screen looked to be 255x255 and limit the CMS.A1 and CMS.A2 values to that, but even so they only set velocity. Unless you know the position now, you can&#39;t really tell which way to move or how far it needs to go. You know you want to go to 512, 384. You just don&#39;t know if you&#39;re at 1024,768 or 0,0 or somewhere in between.

- Bob

The StickWorks
http://www.stickworks.com

It does sound like something that should be easy but I just don&#39;t see any good way. You&#39;d have to scale things so the screen looked to be 255x255 and limit the CMS.A1 and CMS.A2 values to that, but even so they only set velocity. Unless you know the position now, you can&#39;t really tell which way to move or how far it needs to go. You know you want to go to 512, 384. You just don&#39;t know if you&#39;re at 1024,768 or 0,0 or somewhere in between. [/b]

Yeah - that&#39;s why I thought this was my own "I don&#39;t get it". Now "I don&#39;t get it" about how this mouse mapping is supposed to be useful. If you can&#39;t get the virtual mouse position to match the stick position, what is this used for? Why does joystick position map to mouse velocity instead of position?

I guess I had assumed that the software would be able to do something like "map % deflection of joystick to % deflection of mouse". Does this require knowledge of the screen geometry? Sure. Is this past a novice programmer to determine in code (whoever wrote the Control Manager)? Nope. Control Manager could easily determine screen geometry at startup to know how many pixels across the screen is.

Maybe I&#39;m missing the point. In any case what I&#39;m hearing is that mouse position can&#39;t be directly mapped to joystick position, right?

Thanks for the thoughts,

Joel

P.S. You&#39;re right - thought this would be &#39;no brainer easy&#39;...

JNOV
22nd June 2004, 05:56 AM
FYI:

1. Bob wrote the CM software, which is far-and-away, head-and-shoulders better than any other HOTAS software package available (I believe that I have used them all). He is anything but a novice programmer. Check out his website: www.stickworks.com.

2. A mouse is, by its very nature, a relative, velocity-based device, just as it is implemented in CM, e.g., when you "center" your mouse on your mousepad, your cursor doesn&#39;t move to the center of your screen (except by happenstance).

- JNOV

MichaelCHProd
22nd June 2004, 11:27 PM
you&#39;ve done it now JAF....

BladeFireLight
20th October 2004, 04:02 AM
well this is frustrating... I came here looking for a way to use my fighterstick in Freelancer. Guess I need look no further. :(

-Blade FireLight

MichaelCHProd
22nd October 2004, 06:12 AM
Doesn&#39;t Freelancer have joystick support?