WiiFlash + Papervision3D = \m/\m/\m/
Man the title says it all – the WiiFlash server rocks and married with Papervision3D, well, that’s just about a slice of heaven right here in the RockOnFlash studios! Thibault Imbert and Joa Ebert really have done an outstanding job in creating a very solid server and a great looking, easy to use API for working with the wii’s in flash! I gotta say a special thank you to both of them, they really let me beat the crap out of them for 2 weeks leading up to FITC to get the drum demo working and it really was well worth the effort IMHO. Once you try the server and get connected, you’re gonna be hooked – it’s that easy!
First, I wanted to show the WiiBallet app and post the code for the demo. Thibault had asked me to work out a PV3D demo using the WiiFlash server and this is what I came up with. The idea was that a ballet dancer would hold the wii, and dance. Then they’d display the visual on screen as she danced. It was supposed to happen the FlashFestival in France a week ago, but I don’t know if it every quite panned out or not. Still waiting for the pics!
The amazing thing is, I spent 2 seconds on implementing the wii code and getting that connected and the rest of the time was spent on creating the PV3D app, then messing with it to find something that looked decent! The API for WiiFlash server is as easy as it gets:
private var wii:Wiimote = new Wiimote();
// later in the init() method
That’s IT! From there on out, all I had to do was grab the properties I wanted from the wii object I created, applied the angles to the new plane object I was creating on the fly, and BAM, render camera!
// I instanced these at the class level:
private var toDEGREES :Number = 180/Math.PI;
private var toRADIANS :Number = Math.PI/180;
// then we confvert to degrees since the wii props are in radians
(see Keith? I memorized em’ like you said ;))
Source available here – I’ve commented through the code and it’s fairly straight forward. AS3 / Flex builder project files
In the video, you can see how I’m using roll and pitch with the wii to fly around in virtual space. The app creates planes on the fly, and the direction of the stream is dictated by the roll/pitch of the wii and some creative bending of the rules since we don’t have “yaw” with the wii without the sensor bar. To create the the chase cam, I actually created a dummy object (DisplayObject3D) and set it as the camera’s target. Then, I use transform.copy and copy the previous plane’s coordinates to the dummy. I’m later adding some camera movement around the stream based on the x/y properties I’m maintaining. This gave it a nice visual as though the cam were truly affect by the wii stream rather than just clumsily moving around the stream based on some noticeable constraints. I just wish I’d have more time to spend with it – this was about 4hrs total effort, and while it may show, I think it’s a testimony to how easy the WiiFlash API is to use and how well Papervision’s api works.
This last video with WiiFlash server is the drum demo I did at FITC in April. The drums are Papervision3D created in 3D studio max and animated with the Tweener animation classes. The WiiFlash server made this demo possible and very easy to create. This time, with 2 wiiMotes, the WiiFlash server just created another wii object and I was off and running. This was also the first time we’d demo’d Red5 doing midi out. For triggering sounds with any type of speed, we had to go outside the flash player and Red5 provided that via RTMP. The sounds are triggered from a Roland TD-10 sound module. Midi via RTMP – You gotta give it up for Red5🙂