Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Help! I can’t even get a simple demo working!
Remember to call b2Base.initialize() somewhere at the start of your game, or else you’ll get inexplicable null pointer exceptions when doing the simplest of things.
AABB / Matrix classes?Why are there two Vector /
The reason why there are two variants of each is to prevent excessive interaction with the C++ side of things, since b2Vec2 is actually a pointer to a vector, and manipulating that would cause unnecessary interaction between the two. By introducing an intermediate class, you’re able to work with that and then push your changes back all in one go.
Long story short: Use the ones with the non-standard names.
I’m running into runtime errors at the Alchemy/C++ level and can’t make heads or tails of them because they don’t say what died or what line number / file they occurred in.
Errors that happen at the base level will unfortunately have little or no stacktrace to go off of. In most cases, you might be able to work your way up the stacktrace to the offending call in the AS3 library and conclude that you passed in bad parameters (90% of the time) or it’s a legitimate bug. This can quite frequently happen with b2World:Query, Raycast and other functions that take callbacks and you don’t implement the correct arguments or return improper values.
I have a 10 sided polygon, and the last 2 vertices are being corrupted.
Box2D has a maximum limit to the number of sides in a polygon because it statically allocates that space in an array. You can raise the limit by editing ‘b2_maxPolygonVertices’ under b2Settings.h, recompiling from Alchemy, probing for the new memory locations for b2PolygonShape and editing b2PolygonShape.as with those new memory locations.
For example, if you raise it from 8 to 12 sides, m_normals ends up at 120 (from 88) and m_vertexCount ends up at 216 (from 152).