Wii’re done

The BAC Wii project has come to an end for now – we delivered our final report yesterday. Hopefully word of what we’ve done will spread and we’ll be ask to share it with more groups. It was a really cool project to be on – the potential of the Wii and kinesthetic learning is an interesting area – and I don’t think that many people are doing much with it yet. Replacing the mouse with a Wii remote is a great way to increase engagement – I wonder if I could find a way to apply to compliance training? Would make for an interesting course assessment.

Anyway, I’m posting my outline of the Wii controller class that I spent all of January developing. It makes programming for WiiFlash super simple – just instantiate it and boom – Wii support in any Flash app. Works with all typical mouse events.

Wii Controller Engine

  • Is an interface between Wii controllers (Remote and Nunchuk) WiiFlash and the application or game
  • Enables quick ramp up for a developer without having to learn the intricacies of the Wii controllers or their data
    • Can add simple Wii controller to an app in as little as 3 lines of code
    • Contains about 1000 lines of code (not including virtual mouse or WiiFlash itself)
    • WiiFlash returns raw data – engine normalizes it up to make it useful for a developer
    • The Wii controllers return small, but long numbers – 0.000000007199879823173
    • “Smoothing” out the data – eliminates the hand jitter by throwing out small changes and/or averaging data over time
    • Accesses the cursor’s X and Y position – WiiFlash gives you the location of the IR points (prefers 2 of them) as the Remote sees them on a scale from 0-1 – not in relation to your screen area.  Engine handles switching from 2 IR points visible to 1 IR point and convert the data to exact X and Y coordinates of where you’re pointing
  • Creates a secondary “virtual mouse” that allows the Wii mote to act as your normal mouse (separate from WiiFlash’s built-in “mouse control” mode) within the boundaries of your Flash movie
    • Uses Senocluar’s VirtualMouse class
    • A button is single click, B is double click
    • Makes it simple to add Wii capabilities to your app since it works with the mouse controls that you’re used to developing for
    • Allows for custom mouse cursors and the ability to switch between them with 1 line of code
    • Mouse cursors are contained in an external SWF
  • Creates a standard way to getbutton press and release state information for the Remote and the Nunchuk.Provides “isDown” data for major buttons on the Remote and Nunchuk: A, B,C and Z
  • Controls rumble – set the duration
  • Provides Nunchuk data in the same way as the Remote: rotation, acceleration, etc.
  • Nunchuk thumb stick – returns the position of the nub from -100 to +100
    • Also can use the 8 corners as buttons, names represent a compass: N, E, S and W
  • Created (but not tested) with multiple Wii motes in mind – should easily scale to up to 4 Wii motes

5 Comments

  1. I can’t release the code as it is since it’s property of my employer (I developed it at work for work). But I don’t mind showing pieces and answering questions. I want to continue developing it and write in new features – I may eventually release that version since it would be on my own time.

    My IR tracking code is a slightly modified version of Andes Santos’ code which he has posted on his web site:
    http://www.asb-labs.com/blog/flash-gaming-classes-wiimote-wiiflash/
    It’s his wiimoteIR class. His did such a better job than my code did, I used it.

    Reply

  2. Hi and congratulations for your website and the very helpful example u provide. I use the version provided by Andes Santos and it works well. But i have noticed that my wiimote quickly lost the contact with the sensor bar (located at the top of my monitor) in such way that my cursor only covers the first 3/4 of my screen !!!
    Have u notice such behaviors ?

    As i use the andes Santos example, i have declared for each IR point

    sbIRi.x = stageW-(wiimote.ir.pointi.x*stageW);
    sbIRi.y = (wiimote.ir.pointi.y*stageH);

    where stageW & stageH are the size of my screen.

    Thanks in advance for your help.

    Reply

  3. @dougi I found that I had to stand about 4 feet (or a little over 1 meter) away from my screen to get it to work well, any closer and the Wiimote lost sight of the points. I also have a laptop and placed the sensor bar under the display. That helped with the visibility.

    Reply

Leave a Reply to dougi Cancel reply