Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

Download 0.65 Mb.
Date conversion08.07.2018
Size0.65 Mb.
1   ...   22   23   24   25   26   27   28   29   30


I don’t have a Trimersion, and nobody with a Trimersion has tested my program, so this section is entirely theoretical.

The Trimersion head-tracker acts as an ordinary mouse. So you can read it like this:
Var.mickeys = 1200

Var.yaw = MapRange(mouse2.DirectInputX, -var.mickeys,var.mickeys, -90 degrees,90 degrees)

Var.pitch = MapRange(-mouse2.DirectInputY, -var.mickeys,var.mickeys, -90 degrees,90 degrees)
You may need to experiment with changing var.mickeys to other numbers. I don’t know how many mickeys the Trimersion emulates per 90 degrees of rotation.
That code allows you to read it independently of the real mouse, which will probably be mouse1. There is no guarantee that the Trimersion will be mouse2. If you are using a laptop, then the touchpad will probably be mouse1, the mouse will probably be mouse2, and the Trimersion will probably be mouse3.
Normally, all the mice, including the Trimersion, will control the system mouse, and thus control the view in an FPS.
But GlovePIE can swallow the mouse input so that it doesn’t control the system mouse anymore, if that is what you want…
mouse.Swallow = true

mouse.DirectInputX += Delta(mouse1.DirectInputX)

mouse.DirectInputY += Delta(mouse1.DirectInputY)

mouse.LeftButton = mouse1.LeftButton

mouse.RightButton = mouse1.RightButton

mouse.MiddleButton = mouse1.MiddleButton

mouse.XButton1 = mouse1.XButton1

mouse.XButton2 = mouse1.XButton2

debug = var.yaw+', '+var.pitch
Adding the above code will allow mouse1 to control the system mouse, but the Trimersion and other mice will not have any effect on the system mouse.
This is good for if you want to emulate TrackIR with the Trimersion, while controlling other things with the mouse, or for emulating the joystick with the Trimersion.
To emulate a TrackIR you would add:
FakeTrackIR.yaw = var.yaw

FakeTrackIR.pitch = var.pitch

If you have more than one real mouse, you might want to add “or mouse2.LeftButton1”, and “+ Delta(mouse2.DirectInputX)”, etc.
The Trimersion also acts as a keyboard. And GlovePIE can also read multiple keyboards individually. But unlike with the mouse, GlovePIE can’t swallow the keyboard while still reading keyboards individually. So you can tell whether input came from the real keyboard or the Trimersion, but you can’t suppress the input from one while still allowing the input from another. However you can tell the game to ignore the input from the regular keys on both, and have the regular keys on the Trimersion emulate a different set of keys, and have the regular keys on the keyboard emulate a separate different set of keys. In that way, the keyboard and the Trimersion can control different things.
Trimension acts like the following keys (you can use either keyboard2.whatever, or key2.whatever, it makes no difference):
Key2.R, Key2.Space, Key2.E, Key2.F, Key2.Esc, Key2.Enter, Key2.Up, Key2.Down, Key2.Left, Key2.Right, Key2.G, Key2.Tab, Key2.X, Key2.Q, Key2.Z, Key2.LCtrl, Key2.W, Key2.A, Key2.S, Key2.D
Mouse2.LeftButton, Mouse2.RightButton, Mouse2.DirectInputX, Mouse2.DirectInputY

NEW! TrackIR

GlovePIE allows you to read from a real TrackIR, or emulate a fake TrackIR. You can even do both at once. You can also read from other Optitrack devices.

TrackIR support has changed since the previous version. The previous version only used the OptiTrack SDK which anyone can download. For the new version I reverse engineered the TrackIR API that games use, so GlovePIE can also read TrackIR the same way games do. And I added TrackIR emulation.
Let me know if any of the TrackIR reading doesn’t work, because I don’t have a TrackIR to test it on.

NEW! TrackIR emulation

Warning! TrackIR emulation support adds settings to your registry. The first time you run a script that uses fake TrackIR emulation, GlovePIE will add a registry setting which tells programs where to look for the TrackIR driver. GlovePIE tells it that the TrackIR driver is in the GlovePIE directory. The TrackIR driver in the GlovePIE directory is a fake one. This fake driver will then be loaded by any TrackIR game, even if GlovePIE is not running. The fake driver just returns zeroes if GlovePIE isn’t running. GlovePIE will also add another registry entry which says where the real driver is, so that GlovePIE can still use the real driver, but other programs can’t.

To restore the registry to the correct setting, use the CP-Settings > Restore Real TrackIR menu. You only need to do that if you have a real TrackIR and you want to be able to use it instead of the fake one.
There are six values that TrackIR tells the games: Yaw, pitch, roll, x, y, and z.
The first three are angles in degrees. Yaw is turning to the right, pitch is looking up, and roll is tilting your head to the right. The last three are the position of your head: x is how far you moved your head to the right, y is how far you moved your head up, and z is how far you moved the head towards the screen. The position is measured in metres.
In your script you can set them like this:
TrackIR.yaw = VR920.yaw
But I recommend that you be more specific that it is the FakeTrackIR:
FakeTrackIR.yaw = vr920.yaw
They both work, but to prevent ambiguity for things like TrackIR.yaw = TrackIR.yaw + 1, you can specify RealTrackIR.yaw or FakeTrackIR.yaw. Normally reading TrackIR.yaw uses the real TrackIR, but writing it uses the fake one.
When you set the roll, you need to think about whether you want the game world to turn the same direction as your head to exaggerate the movement (like real TrackIR), or do you want the game world to turn in the opposite direction as your head turns, to counteract the movement (like in VR glasses)?
For Virtual Reality, you want roll to be the opposite, like this:

FakeTrackIR.roll = -vr920.roll

For a fixed screen not attached to your head, you want roll to be in the same direction, like this:

FakeTrackIR.roll = wiimote.roll

In both cases it will feel backwards if you do it wrong.
Unfortunately, how a game responds to TrackIR input is not entirely standardised. The value that turns you 180 degrees in one game, might only turn you 90 degrees in another game. I tried to guess which behaviour was most common and used that as the standard, but it still varies from game to game. So sometimes you will have to multiply it or divide it to make it right:
FakeTrackIR.yaw = vr920.yaw / 2
Some games need a totally different multiplier or divisor for the roll than for pitch and yaw. And some games may invert the roll.
Many TrackIR games limit the maximum amount you can turn in each direction. But some games allow you the complete 360 degrees.
To tell which TrackIR game is running, you can read FakeTrackIR.ProfileID. It will be a different number for different games.
You can read FakeTrackIR.Active to tell whether any TrackIR game is currently reading from the fake TrackIR. Games set their ProfileID when they start, but often only set Active while in the main game play part.
FakeTrackIR.RequestFormat tells you which data the TrackIR game wants. GlovePIE provides the same complete data regardless of what the game wants. I’m guessing the RequestFormat is a bitflag representing the x, y, z, yaw, pitch, and roll fields. This may allow you to work out which fields a game supports. But games sometimes ask for the wrong RequestFormat.

FakeTrackIR.WindowHandle tells you the handle of the window that the game registered with TrackIR.

FakeTrackIR.Cursor is true or false and can be turned on or off by games. I don’t know what it means. It may be an attempt to switch between TrackIR being used for mouse-look and being used for TrackIR.
FakeTrackIR.Version is the only value that you can set and the game reads. Games often ask for the version of TrackIR. You can tell it whatever you want. I don’t know the format of this value.
To get a list of at least 87 TrackIR games you can try, see:
The license agreement prohibits use with America’s Army.
TrackIR emulation won’t work with applications that use the Optitrack SDK.

1   ...   22   23   24   25   26   27   28   29   30

The database is protected by copyright © 2016
send message

    Main page