Application: Box2D Editor 1.0

Hello again !

Another post, this time to present the recent 1.0 release of the Box2D-Editor application.

The Box2D physics engine, like every other physics engine (Chipmunk, Farseer, etc.), can only check collisions between convex polygons, with at most 8 vertices. Therefore, if you need an Eiffel Tower in your game, you need to decompose it into convex polygons and then to enter their coordinates vertex by vertex. Said “tedious task” ?

I was saying that too, that’s why I made this application (I make every app because I need them). The Box2D-Editor provides a simple yet powerful interface to easily define the outlines of your assets. The decomposition into convex polygons is then automatic, using one of the provided decomposition algorithms (Ewjordan’s, Mark Bayazit’s). Convex polygons with more than 8 vertices are also automatically splitted.

The only things left are to save the result and to load it directly into your games. The output format is simple so you can easily write your own loaders. A loader implementation is provided for the LibGDX Android/Desktop library.

Google code project page:

http://code.google.com/p/box2d-editor/ Demo game (to show off the loader):

http://code.google.com/p/box2d-editor/downloads/detail?name=libgdx-fixtureatlas-demo-1.0.zip Note: if you create a loader implementation for any other library, whatever the platform (iOS, android, PC, …) and whatever the language (C++, C#, Java, objC, …), I would love to include it in the project, so others could use it too. Thanks in advance.

I really hope you will enjoy it as much as I enjoyed making it. Leave me a comment or a message if it helped you ;-)

Screenshots

The main ui, with “show grid” option enabled:

Using the built-in collision tester:

Built-in collision tester ??

Yep, you can test your bodies by throwing balls at them, in order to make sure that the collisions looks like what you were expecting. Said pretty cool ?

How do I use it ?

The steps are described directly in the tool, and help can be spawned by clicking on the “?” buttons that lie everywhere.

Basically, you just need to start by setting the output file (top left button). If the file already exists, the editor will ask you if you want to load its content. Then, you can add assets (images) to the editor and start defining their contour. Everything will be handled for you after that. However, remember to save your result ;-)