[CCBox2D] I made a cocos2d-flavored wrapper for Box2D

I made a cocos2d-flavored wrapper for Box2D. It's called CCBox2D.

In other words, actual integrated Box2D support for cocos2d, for the first time ever.

You can get the code here:
https://github.com/axcho/CCBox2D

CCBodySprite wraps b2Body in a CCSprite.
CCMotorSprite wraps b2RevoluteJoint in a CCSprite.
CCSpringSprite wraps b2DistanceJoint in a CCSprite.
CCWorldLayer wraps b2World in a CCLayer.

Pretty simple.

There's a project template for Xcode 3, and an as-yet untested project template for Xcode 4. If you have Xcode 4, please test it out and let me know if it works!

I originally posted about this on the cocos2d forums:
http://www.cocos2d-iphone.org/forum/topic/15175

Right now it would just be great to get some feedback on it, any suggestions for how I've organized the wrapper?

The main thing I'm wondering about are my design decisions on the unit conversations. Like cocos2d, I've set up CCBox2D to use pixels instead of meters, and degrees instead of radians. This is straightforward when dealing with position and rotation angles and such. It gets a little weirder when dealing with forces and torques, but not too bad. But I realized that density is probably measured in kilograms per square meter, which if I am to be consistent, I should change to kilograms per square pixel. (As if a pixel could be anything but square!) The reason I hesitate to do this is that then the default would have to be something other than 1.0, in order to match the physical settings that Box2D is tuned for. But I don't want to be inconsistent - that could mess up force calculations, in the unlikely scenario that someone wants to do that sort of thing.

Any thoughts? Your insight would be appreciated. 🙂

Update:
The Xcode 4 template is now confirmed to work correctly! Woo hoo! 😀 I installed Xcode 4 and tested it out. I can't believe it - no bugs on the first try! 🙂
Okay, I decided to use pixels everywhere instead of meters, but to change the mass units to grams instead of kilograms, so the default density (at 32 pixels/meter, and 1000 grams/kilogram) works out to about the same.

Updated posted:
https://github.com/axcho/CCBox2D/commit ... 5afb752cbd

Original thread: https://box2d.org/forum/viewtopic.php?t=6693