Away3D + QuickBox2D (Finally)

I’ll be the first to admit, I’m no 3D programmer – but whenever I needed it in Flash, I just used Papervision3D. It seems the default standard these days and the amount of available information, documentation, and tutorials seems endless. For quite some time though, I’ve been wanting to try out Away3D. The folks who use it, swear by it and I’ve seen some really great stuff done using it. Likewise, I’ve also really been wanting to try out Box2DFlash for some 2d physics simulations. The Box2DFlash api, based on its C++ counterpart, always intimidated the hell out of me though, with its crazy use of capitalization and arbitrary class names. But when Tomek Augustyn/Og2t sent me a message on Twitter suggesting I give QuickBox2D a try, that seemed a good sign that the time was ripe to try out these two new (to me) technologies.

And so, inspired by games like the old classic LineRider and the new Red Bull Soapbox Racer, I came up with this pale comparison. To play, use your mouse to draw line segments (left to right) that will become the track. When done, click “begin” and down you go. Okay, so it’s no award winner, but given the fact I’ve never used Away3D or QuickBox2D before and got that put together over the course of a Saturday, it’s not too shabby and speaks volumes about how easy the two libraries are to pick up.

Some good and bad points of each that learned along the way –

Away3D Drawbacks:

  • I hate hate hate api’s that rely on “initObjects” in class constructors. It always seems like a good idea and makes for a nice clean interface, but I find myself crippled when deprived of code hints. I would much rather enter  default values or nulls into a constructor than selectively decide what properties to instantiate and run the risk of misspelling them or worse yet, not even know what’s available.
  • Probably my own stupid fault, but I couldn’t get the SpringCam working at all. I had to devise my own with a TargetCamera3D instance and a bit of simple easing. I’ll look into that further when I have the time.

Away3D Pluses:

  • Performance seems fantastic for this initial trial.
  • The learning curve (at least coming from PV3D) is pretty freaking low.
  • I love the Skybox6 class. So much easier than creating your own cube and trying to size it nicely as is required in PV3D (though making your background image seems a bit tricky and I just used one that comes with the Away3D demos download.
  • While I haven’t tried them yet, the Pixel Bender filters that come with the Flash 10 release look freakin’ awesome. I’m sure PV3D X will do something similar, but I can’t wait to have the time to dig into these and see what can be accomplished.
  • The materials available are terrific and slightly easier than their PV3D counterparts.

QuickBox2D Points:

Having never used a 2D physics engine before, I can’t make any real comparisons. One thing I loved was how simple it was to pick up. Much easier than diving straight into Box2DFlash. I highly recommend it to anyone getting into 2D physics. One thing that reallyvirked me was when creating a GroupObject containing two CircleObjects (a simple car, e.g.), the CircleObjects won’t rotate – they’ll just slide. I’m sure if I dig further into the Box2D mechanism behind it all, I can figure out a way around that, though.

In any case, both libraries are loads of fun and it was a Saturday well spent…

Date: