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