WiiFlash + Papervision3D = \m/\m/\m/

WiiFlash

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:

[as]
private var wii:Wiimote = new Wiimote();

// later in the init() method
wii.connect();
[/as]

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!

[as]
// 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
plane.pitch(wii.pitch*toDEGREES);
plane.yaw(wii.roll*toDEGREES);
plane.roll(wii.roll*toDEGREES);
[/as]

(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🙂

  1. very cool, thanks for sharing.

  2. niiiiiiice!! That must be the new place in Texas?

  3. Ah now we can all do ballet in or chairs!

    Great stuff!!

  4. that was the small apartment we were in for 2 months – but yeah, it was in TX!

    • Patrick
    • June 1st, 2007

    Hey John, Cool demo
    are u using the standard XP bluetooth stack? or another one?
    I can’t get my WiiMote to connect properly.

    Rock On!

  5. Hey Patrick, as far as I know, the MS stack does not work and people have reported problems everywhere. It’s been reported that the Toshiba drivers work, and I can tell you personally that they do😉

    I bought the Zoom USB Blue Tooth dongle and it ships with the Toshiba drivers and works extremely well.

    • Patrick
    • June 1st, 2007

    Off to the shop then😉 I’m throwing my dongle out the window!
    ………..weeeeeeeeeeee………….

  6. Amazing stuff – as always😉

    \m/

  7. That’s awesome. Great work man.

    • taber
    • June 3rd, 2007

    ridiculously awesome!

  8. holy SNIZZLES!!!

    now I know how to scare the kids away from my computer! Wow……….
    DUDE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    can you give me a haircut – seriously dude – that first “clip” – I think you can be the world’s first virtual barber!

    Imaiging lining up sheep on a conveyor belt🙂

  9. Interesting.

    Any day now I’m expecting to see someone use PaperVision+Apollo+WiiFlash to recreate the Mii Channel perfectly.

  10. nice stuff mate , keep em coming .

  11. this = ownage!
    wiiflash is so nice. the API is so organized and all the calls are logically named…

    wiimote.conect();

    • Jason
    • September 11th, 2007

    Is this Wii controller connected to a WIi at all or just a standard USB port?

  12. you use a BlueTooth connection. I use a USB Bluetooth dongle on my laptop and it works great!

    • PeZ
    • October 11th, 2007

    Are you using a sensorbar or something else to get x & y pos. of the wiimotes on your screen?
    If not, do they need any calibration?

    Thx.

  13. the drums require sensor bar, you can get a battery operated one for $20 at best buy.

    The wiiBallet does not use the IR bar and only uses the roll/pitch properties of the wiiMote

    there is no caliberation, but you can, of course, control the amounts with simple math

    • Ron
    • February 5th, 2008

    Crazy work! I am trying to manipulate visuals and sound with the wiimote myself for a school project. I was wondering how crazy was the drum code? I wanted to disect it and create something myself but I don’t believe you made that code public🙂

    If there is any chance I can get a sample of the code please let me know!

    Once again GREAT WORK!!

    • anthony
    • April 15th, 2008

    Hello,
    I’m a French student and I would work and developp an application which use Flex and Wiimote in order to create a lot of 3D animations!
    Do you use a Sensor Bar or not?Because a lot of applications in the web use it but I don’t understand the goal of this Sensor Bar.
    Congratulations for your project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s