Skip to content

Motion Controls for Wiimote, Nunchuk, Sixaxis, or Move

Ravbug edited this page Jan 14, 2019 · 1 revision

Playstation MOVE is NOT supported in GlovePIE 0.45 Free

NOTE! You need to calibrate your Sixaxis accelerometers before it will recognise gestures! Use the CP-Settings menu to calibrate the minimum and maximum value for each accelerometer.

The Wiimote, Nunchuk, SIXAXIS, Dual Shock 3, and Move all have 3 accelerometers to measure acceleration and tilt. The SIXAXIS/DualShock3 also has 1 gyro to measure horizontal rotation speed. Wii Motion Plus and Playstation Move have 3 gyros to measure rotation speed in any direction.

So there is a common set of gestures, and other motion values, that apply to all of them. There is also an “any” object which supports these gestures.

If there is a gesture called “SwingDown” then you can use it like any of these examples:

Enter = Wiimote.SwingDown
Enter = Nunchuk.SwingDown
Enter = Sixaxis.SwingDown
Enter = Any.SwingDown

Gestures

There are 3 kinds of built-in gestures that GlovePIE now supports. If you want to use gestures that aren’t supported, or you want to tweak them yourself, you need to read the theory section below instead. On the Wiimote, gestures don’t need Motion Plus, but may work slightly better with it attached.

The same set of gestures can be used for the Wii Remote, Nunchuk, SIXAXIS, or “any”.

Poses

These are positions and angles that you hold the Wiimote, Nunchuk, or SIXAXIS in. These values will keep being true as long as the controller stays in that position. Even though poses aren’t keys, you can still use the Pressed and Released functions with poses. Pressed( ) will be true for an instant when you start the pose, and Released ( ) will be true for an instant when you leave the pose. If you want to detect a pose in the GUI, make sure you stop the pose after you do it, or the GUI will wait forever.

UpsideDownOnShoulder: fairly self explanatory. This is where you hold the controller above your shoulder so it is upside down and pointing backwards. It is supposed to represent a bazooka or rocket launcher, with the Wiimote plug being the front of the bazooka. But you could also use this gesture to represent aiming your gun at something behind you, or charging a club/sword/staff attack. Despite its name, you can also use this pose for holding it above your HEAD to charge an attack. But it’s smart enough that it won’t be triggered by the controller being upside-down some other way, such as tilting sideways, or underarm aiming behind you. If you don’t have MotionPlus then you might need to lift it to your shoulder slowly to get it to register.

eg. Key.Four = Pressed(Wiimote.UpsideDownOnShoulder) // switch to rocket launcher
Key.Three = Released(Wiimote.UpsideDownOnShoulder) // switch back to normal gun

LookingAtRightPalm: Only use this if you are holding the controller in your right hand. This is where you hold your palm up a bit and turned a bit so you can read what is written on your palm, imagining that your palm doesn’t have a controller in it. It’s supposed to represent holding a map, or a note. When you do this gesture, ignore the controller and just look at your palm and your fingers while your fingers point upwards. Your hand doesn’t have to be completely vertical, just angled up enough to read it. You can use this gesture for looking at your map, mission objectives, stats, or whatever information screen your game has.

eg. Enter = Pressed(Wiimote.LookingAtRightPalm) // show mission objectives
Esc = Released(Wiimote.LookingAtRightPalm) // exit mission objectives

LookingAtLeftPalm: The same as above, but for the controller in your left hand. Normally you would use Nunchuk.LookingAtLeftPalm. This gives you two different information screens you can look at with an intuitive gesture.You can also use Wiimote.LookingAtLeftPalm if your Wiimote is in the left hand.

Enter = Pressed(Wiimote.LookingAtRightPalm) // show mission objectives
Esc = Released(Wiimote.LookingAtRightPalm) // exit mission objectives
Tab = Pressed(Nunchuk.LookingAtLeftPalm) // show map
Esc = Released(Nunchuk.LookingAtLeftPalm) // exit map

With a Wiimote and Nunchuk, you could have a big two-handed map, like this:

Tab = pressed(Nunchuk.LookingAtLeftPalm and Wiimote.LookingAtRightPalm) Esc = released(Nunchuk.LookingAtLeftPalm and Wiimote.LookingAtRightPalm)

Sixaxis.LookingAtLeftPalm and Sixaxis.LookingAtRightPalm can’t both be true at the same time.

LookingAtWatch: Only use this if you are holding the controller in your left hand. This represents looking at your wrist-watch. It assumes you’re wearing your watch in the western style. It’s supposed to represent a PDA or similar device mounted on your wrist or forearm. It’s for games like Goldeneye, or Commander Keen, where the game menu is actually your watch. But you can use it for any game to look at an information screen in a more immersive way.

// the menu is on your watch
Esc = Pressed(Nunchuk.LookingAtWatch) or Released(Nunchuk.LookingAtWatch)

LookingAtRightWatch: The same as above, but for the controller in your right hand. You may have other devices mounted on your right wrist or forearm. This gives you more information screens to look at intuitively.

Wiimote.OnTable: A bit different from the others. This checks if the Wiimote is still enough to indicate that it must be lying on the table (or in very very steady hands). This could be used to pause the game automatically when you put down the Wiimote. Don’t use this if your table shakes, or if your hands don’t shake. It doesn’t work properly on other controllers yet, just the Wiimote.

// pause when you put down the remote.
P = Pressed(Wiimote.OnTable) or Released(Wiimote.OnTable)

Simple Gestures

These gestures will be true for longer than an instant, but aren’t static poses.

Shake: Shake the controller in any direction. The most unimaginative gesture ever, makes the Wii a laughing stock among some people due to games that only use this gesture.

SwingHorizontal: Swing the controller horizontally. Traditionally used for a light attack.
SwingVertical: Swing the controller vertically. Traditionally used for a heavy attack.
Stabbing: Poke the controller forwards. Used for a poke or thrust attack.

DrumBeat: Used for a beating the drum gesture, true when you hit the imaginary drum at the bottom of your swing.

Two Handed Gestures

These gestures are true for longer than an instant, and tend to turn on and off while repeating the gesture. They require two hands. Don’t forget you can script your own two-handed gestures easily enough using “and” and “keepdown”.

CrossArms: Cross your arms horizontally. That means either the Wii Remote moves left while the Nunchuk moves right, or you quickly roll the SIXAXIS upside-down.

AlternateArmsUpAndDown: Only works on the Wii Remote + Nunchuk, currently. It means the Wii Remote moves up while the Nunchuk moves down, then vice-versa, and repeat. Or the other way around.

Waggle Gestures

These gestures involve holding the controller normally and moving it up, down, left, or right in sequence. These gestures are only true for the instant after they are recognised (like speech recognition). These gestures are all based on MOVING the Wiimote rather than rotating it. They assume you are not rotating the Wiimote at all. They are good for complicated spell gestures.

CircleClockwise: Draw a full circle in the air, clockwise, starting from 12, 3, 6, or 9 o’clock.
CircleAnticlockwise (or CircleCounterClockwise): the same but anticlockwise

There are also 8 different semicircles you can recognise, they use a standard naming system based on the direction that you are going. CurveUpRightDown means go up then right then down in a curve. CurveUpRightDown, CurveDownRightUp, CurveUpLeftDown, CurveDownLeftUp, CurveLeftUpRight, CurveLeftDownRight, CurveRightUpLeft, CurveRightDownLeft

You can add the word Stop on the end to only recognise it if they stop at the end of the gesture. Otherwise a whole circle would also be recognised as a semicircle. It takes longer to recognise, but it allows you to tell the difference between a long gesture and a short one:

CurveUpRightDownStop, CurveDownRightUpStop, CurveUpLeftDownStop, CurveDownLeftUpStop, CurveLeftUpRightStop, CurveLeftDownRightStop, CurveRightUpLeftStop, CurveRightDownLeftStop

This naming scheme can also be used for the 8 different quarters of a circle. CurveUpRight, CurveUpLeft, CurveDownRight, CurveDownLeft, CurveLeftUp, CurveLeftDown, CurveRightUp, CurveRightDown

CurveUpRightStop, CurveUpLeftStop, CurveDownRightStop, CurveDownLeftStop, CurveLeftUpStop, CurveLeftDownStop, CurveRightUpStop, CurveRightDownStop

Or you can have a curvy W, M, 3, or E shape: CurvyM (or CurveUpRightDownUpRightDown)
CurvyW (or CurveDownRightUpDownRightUp)
Curvy3 (or CurveRightDownLeftRightDownLeft)
CurvyE (or CurveLeftDownRightLeftDownRight)
CurveUpLeftDownUpLeftDown
CurveDownLeftUpDownLeftUp
CurveLeftUpRightLeftUpRight
CurveRightUpLeftRightUpLeft

Or a semicircle and then a flick: SwishAndFlick (or CurveDownRightUpDown): the Wingardium Leviosa gesture in the first Harry Potter movie, or drawing a lowercase letter u CurveDownLeftUpDown, CurveUpRightDownUp, CurveUpLeftDownUp, CurveLeftUpRightLeft, CurveLeftDownRightLeft, CurveRightUpLeftRight, CurveRightDownLeftRight,

SwishAndFlickStop (or CurveDownRightUpDownStop), CurveDownLeftUpDownStop, CurveUpRightDownUpStop, CurveUpLeftDownUpStop, CurveLeftUpRightLeftStop, CurveLeftDownRightLeft, CurveRightUpLeftRightStop, CurveRightDownLeftRightStop,

SwishAndFlickAndUp (or CurveDownRightUpDownUp): the same as above, but going back up at the end CurveDownLeftUpDownUp, CurveUpRightDownUpDown, CurveUpLeftDownUpDown, CurveLeftUpRightLeftRight, CurveLeftDownRightLeftRight, CurveRightUpLeftRightLeft, CurveRightDownLeftRightLeft,

Or a semicircle and then a curve: CurveDownLeftUpDownLeft, CurveDownRightUpDownRight CurveUpRightDownUpRight, CurveUpLeftDownUpLeft, CurveLeftUpRightLeftUp, CurveLeftDownRightLeftDown, CurveRightUpLeftRightUp, CurveRightDownLeftRightDown,

There are also straight line gestures:

SwingUp, SwingDown, SwingLeft, SwingRight,

SwingUpStop, SwingDownStop, SwingLeftStop, SwingRightStop,

Or a swing in one direction and then back:

SwingUpDown, SwingDownUp, SwingLeftRight, SwingRightLeft,

SwingUpDownStop, SwingDownUpStop, SwingLeftRightStop, SwingRightLeftStop,

Or a swing in one direction, back, then in that direction again:

SwingUpDownUp, SwingDownUpDown, SwingLeftRightLeft, SwingRightLeftRight,

SwingUpDownUpStop, SwingDownUpDownStop, SwingLeftRightLeftStop, SwingRightLeftRightStop,

Or a double swing:

SwingUpDownUpDown, SwingDownUpDownUp, SwingLeftRightLeftRight, SwingRightLeftRightLeft,

SwingUpDownUpDownStop, SwingDownUpDownUpStop, SwingLeftRightLeftRightStop, SwingRightLeftRightLeftStop,

Or more:

SwingUpDownUpDownUp, SwingDownUpDownUpDown, SwingLeftRightLeftRightLeft, SwingRightLeftRightLeftRight,

That’s all the gestures that are currently preprogramed.

Motion Sensing Theory

The Wiimote, Nunchuk, and Sixaxis each have three accelerometers which measure forces/accelerations (except for those caused by gravity), 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 controller), Y is up (from the controller’s buttons), and Z is forwards (or wherever the controller is pointing). This is the left-handed Direct3D system.

You need to calibrate your Sixaxis accelerometers before you can use it. Use the CP-Settings menu to calibrate the minimum and maximum value for each accelerometer.

If you drop a Wiimote, Nunchuk, or Sixaxis and it is in freefall, all the forces will be zero (because accelerometers can’t detect the force of gravity). BUT if you are holding the controller 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. The force of holding it up SHOULD be cancelled out by gravity, which is why the controller isn’t moving, but the accelerometers can’t detect gravity so it doesn’t cancel out. If you hold the controller flat then the force holding it up will be in the +Y direction, but if you point the controller at the ceiling then the force holding it up will be in the +Z direction. This helps us measure the controller’s 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. Don’t use cxx, cxy, etc. anymore either.

There are three calibrated force values:

gx, gy, and gz

They measure the force/acceleration in Gs. 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

You can use them for measuring actual acceleration, or for measuring tilt.

If you prefer force/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.

They are called Raw because RawAcc values still include gravity. Normally you would want to separate gravity and real acceleration.

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. They will be more accurate if you have Wii Motion Plus.

They are called Rel for “relative” because all these acceleration values are relative to the controller’s orientation. So Z is wherever the controller is pointing, whether that is up, down, left, right, or forwards, rather than a fixed direction such as towards the screen.

Rotations

Accelerometers can tell which way is down, so they can measure tilt. But accelerometers can’t measure horizontal rotation with no tilting. Horizontal rotation is called Yaw, and can only be measured with gyros, or a Sensor Bar, (or a compass, but none of these controllers have a compass).

Gyros only measure rotation speed, rather than their current orientation. So they can’t know for sure which way they are pointing, only how far they have turned since you started.

The Nunchuk has no way of measuring Yaw. The SIXAXIS has 1 gyro for measuring relative Yaw. The Wiimote can sort of measure Yaw while pointing at the sensor bar, but it has no gyros. With Wii Motion Plus the Wiimote has 3 gyros and can measure Yaw properly.

The controllers have these values for measuring rotation:

Yaw, Pitch, Roll
SmoothPitch, SmoothRoll
SteeringAngle

The angles are all in degrees, but can be converted to other units like this “Wiimote.Pitch in radians”.

Yaw is the horizontal angle. It is 0 when the Wiimote is pointing at the middle of the sensor bar, 90 when it is pointing at the right wall, and -90 when it is pointing at the left wall. It is -180 or +180 when pointing backwards. But because it is only measured by a gyro (with Motion Plus) or sensor bar, it will drift, and you need to reset the value in your script. Unlike Pitch and Roll, you can actually set Yaw in your script to tell it what angle you are facing, and the gyro will keep it updated from there. On a Sixaxis the Yaw is 0 when it is facing the same way it was when you started the script. On a Nunchuk, Yaw never changes.

Pitch is the vertical angle. It is 90 when the controller 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. Pitch never goes past 90.

Roll is how much the top is tilted towards the right. It is -180 or +180 when the controller 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, especially when the controller is moving. You can use SmoothPitch and SmoothRoll if you don’t mind getting the wrong result if the controller moves, but you do want it to be smooth.

SmoothPitch and SmoothRoll should not be confused with the Smooth function. SmoothPitch and SmoothRoll are not smoothed or filtered in any way. You can still use the Smooth function to filter either SmoothPitch or normal Pitch for example.

SteeringAngle is used for when you hold the Wii Remote or SIXAXIS like a steering wheel. With a Wii Remote that means the DPad and A button are on the left, and the 1 and 2 buttons are on the right (like normal). With either controller it doesn’t matter whether the buttons are pointing towards you, or pointing at the ceiling. The range is -360 to +360, and 0 when flat. + means turning right, and - means turning left. Turning more than 360 degrees in one direction wraps back around to 0. Because it goes from -360 to 360 it means the same orientation will be reported in two different ways depending on which way you turned to got there (pointing at the ceiling is either 90 or -270).

There is also a rotation matrix, for those who prefer it. It is a 3x3 Direct3D style rotation matrix: RotMat. It didn’t work properly in previous versions, but it works now.

The gyros actually measure rotation speed. So you have extra values based on the gyros:

YawSpeed, PitchSpeed, RollSpeed

Clone this wiki locally