Fantastic. You’re a hero.
I finally decided to shirk my real work and try this out.
Fortunately I’ve got a pretty good idea how Box2D works from using Love2D, but wading through the documentation is still a bit painful. Your example project is very helpful to have. I might submit a PR later to make the documentation more pretty and possibly split it up into multiple documents, if you’re open to that?
Question 1:
Would it be a pain to shorten the names of the constants? Or are you committed to having the C+±style prefixes on everything?
It’s pretty annoying to type: “box2d.b2BodyType.b2_dynamicBody” every time (not to mention it’s hard to read.)
I would prefer: “box2d.BodyType.dynamic”, or maybe: “box2d.TYPE_DYNAMIC” to make it fit with the Defold API and the naming conventions for constants that I’m familiar with.
And all the others, like:
box2d.b2Shape.e_circle → box2d.SHAPE_CIRCLE
box2d.b2Draw.e_shapeBit → box2d.DRAW_SHAPE_BIT
[Edit] Maybe even shorten the common ones more, since there’s no overlap, i.e: box2d.CIRCLE, box2d.DYNAMIC
Of course the end user can always make their own aliases, so it’s not a huge deal.
Question 2:
I think I know this one, but just to check: All the units for making shapes and body positions are in Box2D “meters” right? And the physics_scale for the debug draw is only to scale the drawing?
Question 3:
Can the velocity iterations and position iterations for Box2dWorld:Step() have default values? I imagine 99% of users will just use the recommended values of 8 and 3 (but they’ll have to look them up too).