Table of Contents

Virtual Reality

So, for my Build 18 project this year, my partner Alex and I wanted to do something cool and awesome. I had a few ideas floating around, and I had seen Nirav Patel's post on the subject of virtual reality gaming with the PNI SpacePoint Fusion. Alex thought it was a good idea, and so we ran with it. As it turns out, PNI has a nice student sponsorship program if you get in touch with the right people, and they were willing to send me their USB version of the SpacePoint Fusion (a discontinued product?!) as long as I did a writeup about it! So, here goes :-)

Tutorial Notes

Components Needed

Nirav's original design only called for one SpacePoint Fusion and a nifty portable projector that went on top of his Wii Zapper. I personally wanted to see if we could get away with both head and gun inputs and couple that with a head-mounted display.

Setting up the Software

Nirav used Ubuntu, but I took the long and frustrated route of seeing if it worked in OS X as well (see the FAQ's for more info). Long story short, it didn't work, and developing in Ubuntu ended up being a much faster process!

Compile Cube and LibHID

#Allow all dependencies to be installed as well. Installs SDL & dependencies, OpenGL, Zlib, libpng
sudo apt-get install g++ libusb-dev libsdl1.2-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libenet-dev
cd ~/Downloads
tar .zxvf libhid-0.2.--.tar.gz
cd libhid-0.2.--
./configure
make
sudo make install
#Add -fpermissive to the end 
CXXOPTFLAGS=-Wall -O3 -fsigned-char -fomit-frame-pointer -fpermissive

Modifying Cube Source Code

Set udev rules

On first start, I got a bunch of errors from libhid about not seeing the SpacePoint unless I ran the process using sudo. After reading Nirav's tutorial again, I saw his note on the end about setting the udev rules correctly.

On most modern Linux distros, you can fix this by setting a udev rule for the device. In Ubuntu Karmic Koala, saving the following as /etc/udev/rules.d/45-spacepoint.rules , running sudo service udev restart , and then unplugging and replugging in the device should fix it:

# PNI SpacePoint Fusion
SYSFS{idVendor}=="20ff", SYSFS{idProduct}=="0100", MODE="0664", GROUP="admin"

Set up Wii Remote

All this does is map buttons on the Wii Remote to buttons on the keyboard :-)

    1. Create a config file located in /etc/cwiid/wminput
    2. To run this file below:
sudo wminput -c fps_config2
fps_config2
# Fps config for wminput by kyrlian
# needs plugin nunchuk_kb
 
#File is located 
 
#custom buttons
Wiimote.A               = KEY_ENTER
Wiimote.B               = BTN_LEFT
Wiimote.Up              = KEY_UP
Wiimote.Down    	= KEY_DOWN
Wiimote.Left    	= KEY_LEFT
Wiimote.Right   	= KEY_RIGHT
Wiimote.Minus  		= KEY_PAGEDOWN
Wiimote.Plus   		= KEY_PAGEUP
Wiimote.Home  		= KEY_ESC
 
Wiimote.1       	= KEY_TAB
Wiimote.2       	= KEY_ESC
 
Nunchuk.C               = KEY_SEMICOLON
Nunchuk.Z               = KEY_SPACE
 
#plugin for nunchuk stick
Plugin.nunchuk_kb.Up	= KEY_UP
Plugin.nunchuk_kb.Down	= KEY_DOWN
Plugin.nunchuk_kb.Left	= KEY_LEFT
Plugin.nunchuk_kb.Right	= KEY_RIGHT

FAQ's

Extensions

Future Ideas

AR Markers