Getting the WiiMote to work
jReality comes with a WiiMote driver. It depends on an additional program, either DarwiinRemoteOSC for Macs or wiiosc for Linux (tested with v0.3), to convert WiiMote events into OSC messages. This unfortunate detour is necessary because none of the currently available WiiMote or Bluetooth libraries for Java seem satisfactory.
Contents
Adapting the tool configuration file
For now it is required to adapt the tool config file (toolconfig.xml
) to enable the WiiMoteOSC device. You will find this file in src-tool/de/jreality/toolsystem/config
folder. Just make sure, that the following lines are not commented out:
Line 12:
<rawdevice id="WiiMoteOSC" type="de.jreality.toolsystem.raw.WiiMoteOSC"/>
Lines 22-34:
<mapping device="WiiMoteOSC" src="/wii/button/up" target="forward"/> <mapping device="WiiMoteOSC" src="/wii/button/down" target="backward"/> <mapping device="WiiMoteOSC" src="/wii/button/left" target="left"/> <mapping device="WiiMoteOSC" src="/wii/button/right" target="right"/> <mapping device="WiiMoteOSC" src="/wii/button/a" target="PrimaryAction"/> <mapping device="WiiMoteOSC" src="/wii/button/b" target="PrimarySelection"/> <mapping device="WiiMoteOSC" src="/wii/button/home" target="PrimaryMenu"/> <mapping device="WiiMoteOSC" src="/wii/button/plus" target="JumpActivation"/> <mapping device="WiiMoteOSC" src="/wii/button/minus" target="GravityToggle"/> <mapping device="WiiMoteOSC" src="/wii/button/one" target="pageUp"/> <mapping device="WiiMoteOSC" src="/wii/button/two" target="pageDown"/> <mapping device="WiiMoteOSC" src="pointer" target="PointerNDC"/> <mapping device="WiiMoteOSC" src="evolution" target="PointerNDCevolution"/>
Instructions for Mac OS X
- Install DarwiinRemoteOSC.
- Launch DarwiinRemoteOSC.
- Pair your WiiMote with the computer (i.e., push 1 and 2 on the WiiMote at the same time). After a few seconds, you should see some squiggly lines in the DarwiinRemoteOSC window if you shake the WiiMote.
Instructions for Linux
- Install wiiosc.
- Launch wiiosc from the command line, with the following parameters:
wiiosc 5600 57150 127.0.0.1 auto
- Pair your WiiMote with your computer (i.e., push 1 and 2 on the WiiMote at the same time). After a few seconds, wiiosc should confirm the connection with the WiiMote.
Instructions for Windows
Not sure; if you're lucky, you may be able to install wiiosc and use the Linux approach. If you figure out how to do this, please let us know.
The basic idea is that the WiiMote maps to events that are very similar to mouse and keyboard events.
- Roll and pitch: x and y coordinates
- D-pad: arrow keys
- Button A: left mouse button
- Button B: right mouse button
- Home button: middle mouse button
- Plus button: jump
- Minus button: toggle gravity
- Button 1: page up
- Button 2: page down
Fun and games
With the WiiMote, you can easily do a few things that are hard to accomplish with a mouse. For instance, if you roll the WiiMote to the left while holding down the right button of the D-pad, you will travel in a circle, facing inward.