Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

Download 489 Kb.
Size489 Kb.
1   ...   5   6   7   8   9   10   11   12   ...   30

Camera Position

You can also set the camera position and angle with the following fields:

Cam.Yaw, Pitch, Roll, x, y, z, pos (a vector), RotMat (a rotation matrix)
Cam.yaw = vr920.yaw

Cam.pitch = vr920.pitch

Cam.roll = -vr920.roll

Cam.z = -2 metres

You can also read the Cam.WalkFwdDir, Cam.WalkBackDir, cam.WalkLeftDir, cam.WalkRightDir, cam.WalkUpDir, and cam.WalkDownDir vectors.
Those vectors are used for adding to the camera position based on user input.
If W then cam.pos += Cam.WalkFwdDir * 8 kph

If A then cam.pos += Cam.WalkLeftDir * 8 kph


Background colour

Set the background colour to either [r, g, b] or 0xRRGGBB

Cam.BgColour = [10%, 30%, 100%]

Stereoscopic 3D

You can also use stereoscopic 3D if you have Red/Cyan 3D glasses:

Cam.Stereo = true
You can set the screen depth for stereo like this:
Cam.ScreenDepth = 9 feet
You can set the eye separation like this:
Cam.EyeSeparation = 4 cm

Camera Lens

You can change the camera lens by setting its FOV:

Cam.vFOV = 60 degrees
That sets the vertical field of view.

You can also set the NearClip and FarClip distances. Only objects between these two distances will be drawn. Setting NearClip too small makes the distant objects intersect when they shouldn’t.

Cam.NearClip = 20cm

Cam.FarClip = 100 metres


A computer can have several mice, track-pads, track-balls and other such devices attached. But it only has one real mouse cursor. Also most games only see a single mouse, called the “system mouse”. The system mouse is an imaginary combination of all the hardware mice and track-pads put together. Moving any mouse to the left will move the “system mouse” and the on-screen mouse pointer to the left. Pressing any mouse’s left button will be seen as clicking the left button on the “system mouse”.

The physical movement of each mouse on the desk is measured in units called “mickeys”. The size of this unit depends on the mouse. It is often listed on the box as Dots Per Inch, or DPI. “Dots” here refers to “mickeys”. My Microsoft wireless optical mouse has 400 DPI, meaning one mickey is 1/400 inches, or less then a tenth of a millimetre. There is no way of knowing the exact physical position of the mouse, but you can only tell how far it has moved from its starting position.
The location of the mouse pointer on the screen is measured in pixels. Windows uses a complicated algorithm called “mouse ballistics” to determine how far to move the cursor based on the physical movement of the mouse. It varies for different versions of Windows and for different control panel settings, and for different monitor sizes. Many people have multiple monitors attached to their computer, and the mouse pointer can move from one to the other. If the mouse is on a screen to the left of the primary monitor then it will have a negative pixel coordinate for its x position. If the mouse is on a screen to the right of the primary monitor it will have a pixel coordinate greater than the horizontal resolution of the screen.
Some games use the mouse pointer’s position on the screen. But other games, especially First Person Shooters like DooM, don’t use a mouse pointer, and instead just read the physical movement of the mouse in Mickeys. Just because a game has a mouse pointer, doesn’t mean it uses the normal Windows one. Sometimes it just reads the physical mouse movements and draws its own pointer in its own private location that it is impossible for GlovePIE to know about.

Mouse.DirectInputX and Mouse.DirectInputY

In GlovePIE, you can read and set the physical movement of the mouse, in mickeys, by using the mouse.DirectInputX and mouse.DirectInputY values. It is called DirectInput because games use Microsoft’s DirectInput to read these values directly from the mouse hardware.

If you have multiple mice, and you have Windows XP, you can read the positions of individual mice with mouse1.DirectInputX, mouse2.DirectInputX, etc. Otherwise you can just use mouse.DirectInputX (without any number) to get the combined location of all the mice representing the “System mouse”. You can’t set the position of individual mice (since most games can’t read individual mice), so you always have to set mouse.DirectInputX without a number before the dot. Note that laptops usually have multiple mice, since the track-pad counts as a mouse.
Mouse.DirectInputX is the left/right position, with negative values to the left and positive values to the right. Mouse.DirectInputY is the forwards/backwards position, with negative values meaning forwards and positive values meaning backwards.
Where-ever the mouse was when you pressed the Run button will be considered the point (0, 0) where both mouse.DirectInputX and mouse.DirectInputY are equal to 0.
If you then move the mouse 1 inch to the right, the mouse.DirectInputX value will go up to 400, or whatever DPI your mouse is.
You can read these values, to find out where the mouse is, or you can set them, to trick games into thinking that the mouse has been moved to a new physical location.
Because PIE supports different units, you can also read the value in normal units of distance, like centimetres or inches.
For example:
midi.BassDrum1 = mouse.DirectInputX < -0.5 inches

midi.CrashCymbal1 = mouse.DirectInputX > 0.5 inches

debug = mouse.DirectInputX in inches
This will play a drum when you move the mouse half an inch to the left of its starting point, and play a cymbal when you move the mouse half an inch to the right of its starting point. It will also display the physical location of the mouse in the debug box. Note that people are used to moving the mouse tiny amounts, so it feels weird moving the mouse large distances. But if you want to use the mouse as a physical tracking device like this you can.
Note that if your mouse is not the default 400 DPI, then you need to set the value Pie.MouseDPI to whatever your mouse’s DPI is. For example, for my mum’s new mouse:
Pie.MouseDPI = 800

midi.BassDrum1 = mouse.DirectInputX < -0.5 inches

midi.CrashCymbal1 = mouse.DirectInputX > 0.5 inches

debug = mouse.DirectInputX in inches

You can also check with a ruler to make sure you got it right.
You can also set the values to control the system mouse in any game or application. It doesn’t matter whether the game uses the mouse cursor or reads the mouse directly. For example if you want to control the mouse with a joystick, like this:
mouse.DirectInputX = mouse.DirectInputX + 100*deadzone(joystick.x)

mouse.DirectInputY = mouse.DirectInputY + 100*deadzone(joystick.y)

Every frame (40 times per second) it will add or subtract a certain amount based on the position of the joystick. The deadzone function stops it from drifting if your joystick is not calibrated correctly.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   ...   30

The database is protected by copyright © 2019
send message

    Main page