Returns a handle of the bluetooth input device - such as a WiiMote®, Nunchuk® or Balance Board - with the given number (1..4). If a bluetooth input device with the given number is not detected, the function returns 0. The device must be switched on and connected (see below) before the start of the application, and joysticks must not be disabled with -nj command line option.
Returns the number of all connected bluetooth input devices. Note: the Bluesoleil driver always detects all devices even if they are not connected sanymore.
wiimote_status(var handle, void* wiimote)
Updates the device status - motion sensors, orientation, IR sensor, analog stick and button states - into the WIIMOTE struct passed as second argument. The WIIMOTE struct is defined in include\ackwii.h.
wiimote_smoothfac(var handle, var fac)
Sets a factor (0..1) for smoothing the Wiimote angle data.
wiimote_led(var handle, var ledmask)
Turns the 4 LEDs on or off.
wiimote_vibration(var handle, var on)
Turns the vibration on (1) or off (0).
wiimote_ir(var handle, var on)
Enables/disables the infrared camera. The camera is able to detect the positions of up to 4 infrared spots, and allows to use the WiiMote as a pointing device.
wiimote_ir_sensitivity(var handle, var level)
Sets the sensitivity level for the infrared camera. The IRPTR struct (see include\ackwii.h) can be used for retrieving raw data about the pointer position.
Checks whether a certain device is connected and active. Returns 0 for inactive and nonzero for active.
Returns the battery charge in percent (0..100).
handle - Handle for identifying the WiiMote.
on - 0 for off and 1 for on.
fac - 0 for no effect, 0.999 for full effect.
ledmask - Binary value (0..15) with 1 bit for every LED. 1 = on, 0 = off.
Connecting a WiiMote to the PC
Only devices that are switched on, set to a certain number (default = 0), and connected to the PC before the start of the application can be used with the wiimote functions. Setting the WiiMote to a certain number is described in the WiiMote manual. Here's how to to connect it to the Bluetooth stack of the PC (also called 'pairing').
Connect to Windows' built-in Bluetooth stack:
- Open the Bluetooth control panel.
- Press and hold the  and  buttons on the WiiMote simultaneously. The blue LEDs will start to flash, indicating that the WiiMote is now in 'discoverable' mode for a few seconds. The number of LEDs reflects the battery level. If the blue LEDs stop flashing during the following connection procedure, press and hold  and  again. It's important to keep them flashing until the connection is complete. Otherwise the WiiMote usually times out half-way through the procedure, and although it appears in the control panel, it's not paired and doesn't work.
- Add a new device in the Control panel. It will be detected as 'Nintendo RVL-CNT-01'. Select 'No Password' in the password panel.
- If the installation is finished, let go of  and . The Bluetooth control panel should now show it 'connected' and the wiimote_handle function should detect it after start of the application. The single blue LED displays the number of the device (1..4).
- If something goes wrong, remove the device from the control panel. You must remove and re-detect it before you can connect it again.
Connect to the Toshiba® Bluetooth stack:
- Straight forward, press  and  on the Wiimote (you don't need to hold them if you're quick) and click 'New Connection'.
- Once found, you can pair it anytime again by right-clicking its device icon and pressing  and  simultaneously as before. You can also set up a desktop shortcut that enters discovery mode immediately.
Disconnect/unpair to save power (any stack):
- Hold the Wiimote [Power] button for a few seconds - it automatically unpairs itself, re-enters pairing mode for a few seconds (flashing LEDs), then times out and effectively switches off.
- Wii, WiiMote, Nunchuk are trademarks by Nintendo®, Inc. The ackwii plugin was developed by Robert Jäger (firoball).
- The plugin ackwii.dll must be loaded and the file ackwii.h must be included for using the wiimote functions. The -nj startup option prevents the engine from automatically detecting bluetooth devices.
- Bluetooth input device 1 is automatically used for the second joystick if only one joystick is connected, and for the first joystick if no joystick is connected. Further devices can be used through the wiimote_status function.
- The orientation and acceleration values are not very precise and subject to 'jitter'. This can be controlled with the wiimote_smoothfac function.
// Sample script demonstrating usage of a Bluetooth input device
// The WiiMote must be connected to the PC prior to starting the application
// For connecting a WiiMote, see manual->engine functions->wiimote
// assigned to [A] button
void toggleVibration (var handle, WIIMOTE* wiimote)
wiimote_vibration(handle, 1 - wiimote.status.vibration);
void main ()
// get a handle to the first Wiimote
var wii_handle = wiimote_handle(1);
if (!wii_handle) printf("No WiiMote connected!");
// create a screen entity to be controlled by the WiiMote
you = ent_createlayer("earth.mdl",0,0);
// assign a function to Wiimote [A] button
wiimote.event.on_a = toggleVibration;
// update buffer with data coming from Wiimote
► latest version online