Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9



Download 0.65 Mb.
Page18/30
Date conversion08.07.2018
Size0.65 Mb.
1   ...   14   15   16   17   18   19   20   21   ...   30

Buttons

The Wiimote has the following buttons, which are either true or false:


Up, Down, Left, Right,

A, B,


Minus, Home, Plus

One, Two
The Power button, and the Sync button (hidden under the battery compartment) aren’t implemented yet.



Motion Sensing

The Wiimote also has three accelerometers which measure forces/accelerations, in each of the three dimensions. Force and Acceleration are basically the same thing, since the mass is constant (F=ma). In GlovePIE they are labelled like this: X is to the right (of the wiimote), Y is up (from the wiimote buttons), and Z is forwards (or wherever the wiimote is pointing). This is the left-handed Direct3D system.


If you drop a Wiimote and it is in freefall, all the forces will be zero. BUT if you are holding a wiimote up so that it doesn’t fall, then you are pushing it upwards with a force equal to the force of gravity, but in the upwards direction. If you hold the Wiimote flat then the force holding it up will be in the +Y direction, but if you point the Wiimote at the ceiling then the force holding it up will be in the +Z direction. This helps us measure the Wiimotes tilt as well as its acceleration.
There are three values that you should never use anymore, because they are obsolete and only for backwards compatability: RawForceX, RawForceY, and RawForceZ. If your script is currently using them, then replace them with the calibrated force values below. Remember the calibrated force values don’t need an offset, and they are about 1/30 the size of the RawForce values.
There are three calibrated force values:
gx, gy, and gz
They can be zero for no force/acceleration, 1 for the same amount of force/acceleration as gravity, or any value in between or outside that range. There is also the vector version:
g
The accelerations above are effectively measured in Gs. You can use them for measuring actual acceleration, or for measuring tilt.
If you prefer acceleration values in other units, you can use these values:
RawAccX, RawAccY, and RawAccZ.
They are measured in Metres Per Second Per Second. But GlovePIE supports units so you can do things like this:
RawAccX in miles per hour per second
to get the value in different units.
The RawAcc values still include gravity.
If you want to get the real acceleration without gravity then you should use the following values instead:
RelAccX, RelAccY, and RelAccZ
They are not very accurate because it is hard for GlovePIE to separate out the force of gravity, but it makes a good attempt.
All these acceleration values are relative to the Wiimote’s orientation. So Z is wherever the Wiimote is pointing, not necessarily a fixed direction.

Rotations

The Wiimote doesn’t contain gyros (BOO!!!), so it has no way of determining the yaw rotation without using an imitation sensor bar. But it can sort-of tell which way is down, based on the force of gravity. This allows it to measure pitch and roll rotations. You can use the following values:


Pitch, Roll

SmoothPitch, SmoothRoll


The angles are all in degrees.
Pitch is the vertical angle. It is 90 when the wiimote is pointing at the ceiling, -90 when it is pointing at the ground, 0 when it is flat, and a value in between for angles in between.
Roll is how much the top is tilted towards the right. It is -180 or +180 when the Wiimote is upside-down, -90 when it is on its left side, +90 when it is on its right side. and 0 when it is flat.
Pitch and Roll attempt to filter out accelerations. This may make them slightly jagged. You can use SmoothPitch and SmoothRoll if you don’t mind getting the wrong result if the wiimote moves, but you do want it to be smooth.
There is also a rotation matrix, for those who prefer it. It is a 3x3 Direct3D style rotation matrix:

RotMat


Sensor Bar

The sensor bar is just a bunch of Infra Red lights which are always on. You can make your own fake sensor bar with candles, Christmas tree lights, or Infra-Red remote controls with a button held down. Or you can order a wireless sensor bar off the internet, or you can build your own.


You can read the position of the infra-red dots that the Wiimote can see with:

wiimote.dot1x, wiimote.dot1y

wiimote.dot4x, wiimote.dot4y


You can tell whether an infra-red dot can be seen with Wiimote.dot1vis to Wiimote.dot4vis
You can tell the size of a dot (between 0 and 15) with Wiimote.dot1size to Wiimote.dot4size
The size will always be reported as 16 if your script uses the Nunchuk or Classic Controller, because the report needs to contain more information.

LEDs

You can set the 4 LEDs on the Wiimote by setting:


Wiimote.Leds
to a value between 0 and 15. It is binary.
Or you can set:
Wiimote.Led1, Wiimote.Led2, Wiimote.Led3, and Wiimote.Led4
to either true or false individually.

Force Feedback

You can activate force feedback by setting:


Wiimote.Rumble
to either true or false

Speaker

You can play sounds on the Wiimote simply by setting these values:


Frequency, Volume
If you set Frequency to 0 it will switch the speaker off. If you set it to non-zero it will switch the speaker on again. The frequency is measured in Hz. Don’t confuse frequency with pitch, they are different in this context.
You can set the volume to a value between 0 and 2, (between 0% and 200% in other words). I don’t recommend setting it above 100% though, unless you want to go deaf.
You can also turn the speaker on and off by setting either of these values:
Speaker, Mute
Setting speaker to true switches on the speaker (slowly) and setting it to false switches off the speaker. Setting Mute to true mutes the speaker, and setting it to false un-mutes it. Using
”Mute” works faster than using “Speaker”. Note that you don’t need to turn the speaker on if you set the frequency, because setting the frequency to non-zero does it automatically. Turning sound on and off with mute is also faster than doing it by changing the frequency to 0.
You can also set the sample rate with this variable:
SampleRate
Currently GlovePIE only supports sample rates around 3640 Hz. Sample rates must be multiples of 280 added or subtracted from that value. The default is 3640 Hz. The sample rate is also measured in Hz. The sample rate will automatically increase if you set the frequency higher than 1820 Hz. There isn’t much point in changing the sample rate.


1   ...   14   15   16   17   18   19   20   21   ...   30


The database is protected by copyright ©dentisty.org 2016
send message

    Main page