Who makes Box2DFlash?
Currently, I, Boris the Brave maintain Box2DFlash, and add new featuers. But credit belongs just as much to Erin Catto, the original creator of Box2D, to Matt Bush and John Nesky for their work in porting.
There's a lot of Box2D projects, what is what?
Yes, there are. Box2D is pretty popular, and easy to port. Many 2d physics engines have drawn from it, too. I cannot go over all of the possible options, so I'll just try to disambiguate some confusion.
The project you are looking at now, Box2DFlash, is the most "official" port available to AS3, in the sense that it has kept up with the C++ version since v1.4.2. It is also referred to as Box2DAS3, and Box2DFlashAS3. The source repository is project
box2dflash on sourceforge.
There are other physics engines also labeled Box2D, are in various stages of support and up-to-dateness. Google Code's Box2DFlash is not the same project as this. Nor is it up to date, as of writing (2010/01/09).
Other engines of note in the same family include the unnamed Alchemy based port which is part of the World Construction Kit and Haxe-based libraries Physaxe and Motor2.
Please contact me if you disagree with the above assesment, or would like a mention.
How can I help?
At the moment, this project is pretty much a one-man show, though with much help from the forums. Please contact me, if you are interested in a serious contribution. You can always send me patches, and bug reports.
Why is the API so strange?
Box2DAS3 is a port of the C++ version, and has kept the API largely identical. This means it does a lot of things differently to how you might expect. For example most arrays are of fixed size, with a variable elsewhere indicating how many valid items it contains.
Why aren't my bodies moving?
Here are some of the more common pitfalls:
- Are you actually making them move in some way, e.g. gravity or ApplyForce?
- Is the body dynamic? You must make bodies dynamic using b2BodyDef.type.
- Is it asleep? In some circumstances, you may need call WakeUp, see the manual for details.
- Is the graphics actually moving stuff? Try using DebugDraw as a double check.
- Is your sense of scale correct? Ensure you understand the difference between screen pixels and Box2D units. By default there is a factor of 30. Also try to make shapes of size between 0.1 and 100 units, this is the rough range that Box2D has been tuned for.
- Is your other sense of scale correct? Are you applying enough force to the mass of your object to move it?
Why are my bodies behaving strangely
Box2D is designed for games, and speed, so it doesn't always simulate physics accurately. Try to follow the following guidelines:
- Don't stand a large body on top of a small one, or other circumstances than involve passing a lot of force through a small body.
- Don't have long chains of joints, or large stacks.
- Don't expect perfect physics if you are updating something every frame (e.g. resetting a body's position, or resizing a shape).
I'm getting compiler errors about angle brackets, "<"!
Sounds like you are trying to compile the Flash 10 version on a Flash 9 compiler. Download the appropriate release of Box2D, or update your compiler.