Physics!

David Shaw, 7:46 am 8th September 2009
Posted under: Blog Babble

For my prototype, I need to have some asteroid-like objects floating around. That means I’ll need to have some form of collision detection. If I want my asteroids to be irregular and somewhat large, then it becomes non-trivial. I did a few rough sketches to figure out an appropriate approach, but I quickly decided it’s not worth the effort hacking together something myself. I might as well look at what physics solutions are already out there: far quicker, less hassle, more reliable and I can get greater functionality out of it too.

I had a look at Bullet and got the demos running under Xcode. It looks pretty sweet, but I wasn’t sure I needed the power of a 3D collision library. I’ll keep in mind though if I go that way.

Instead, I’m going with Box 2D. This also looks pretty nice, and I only need 2D physics. The clincher was that it has been ported to Flash, which is ideal for me. I can use a similar interface in both domains.

Given Box2D is implemented in Flash as well as C++, I’m leaning towards implementing the prototype in Flash. I feel far more comfortable playing around in Flash and ActionScript; in C++, I feel the urge to focus on writing nice code rather than just implementing ideas. If I know my way around a physics library in Flash, it should be a snap to prototype all sorts of things. Just playing with the physics demos is fairly fun all by itself, so it sounds like a perfect platform for getting a feel on new ideas.



Leave a Reply