Physics Body Editor 2.0 (ex- Box2d Editor)

Oct 1, 2011 by     45 Comments    Posted under: Desktop applications, Physics Body Editor



I recently massively updated the Box2d-Editor!

  • For starters, I renamed it into Physics Body Editor, since it is not strongly linked to box2d and can be used with other physics engines like Chipmunk or Farseer. This way, it will also be more easily integrated ino the incoming Physics Level Editor.
  • Secondly, I fixed all the reported bugs. It appeared that the rendering framework used, LibGDX, does not correctly handles the CONTROL and SHIFT keys for some Mac OS users. Therefore, I also added “C” and “S” keys as alternatives. Asset paths were not system independent, which is now corrected too.
  • Then, I added the possibility to export your saves as XML or JSON, to complete the existing binary format with some text-based formats. Writing your own loaders should be much easier now! Just look at a save file to understand how it is organized, it should be very easy to understand.
  • Last but not least, I totally changed the application UI, in order to make it more simple and more easy to use. A new button is available: “New project”. It opens a dialog which let you choose a save path, and choose the desired format.

Hope you’ll enjoy it, I spent a loooot of time polishing it !

Project page:

45 Comments + Add Comment

  • [...] systems processing the entities. Also, these objects were created using Aurélien Ribon’s Physics Body Editor. I plan to use that a lot when I start creating levels, so that was another tool I wanted to get [...]

  • This looks really good, but I’m still confused on how to load this into cocos2d. Can you explain how to do this?
    Thanks a lot for your free software and keep up the good work

    • Since I never worked with Objective-C and the iOS API, I can’t help you with code, but here is the common procedure:

      1. Use the editor and save a project file as XML (for instance),
      2. Put that file in your cocos2d project data folder,
      3. In your game code, use your favorite XML reader class (I’m sure there is one in iOS API) to parse the file,
      4. What’s interesting you is the list of polygons for each asset, which comes as follows:

          <asset relativePath="gfx\test01.png">
                  <vertex x="65.82031" y="85.9375"/>
                  <vertex x="55.664062" y="85.74219"/>
                  <vertex x="58.203125" y="81.640625"/>
                  <vertex x="68.16406" y="82.421875"/>
                  <vertex x="68.16406" y="82.421875"/>
                  <vertex x="71.875" y="90.03906"/>
                  <vertex x="67.96875" y="90.42969"/>
                  <vertex x="65.82031" y="85.9375"/>

      All you need to do is to retrieve these lists of convex polygons and use them to define the shapes of your box2d bodies. Have a look to the loader I made for libGDX in java, it should be straight-forward to port it to cocos2d.

  • wow, thanks so much. I really appreciate your free tools, i’m head of a club at school that makes iphone apps and we will use this alot

  • Great tool.If i make anything “commercial” with it i will donate something.

    Question : Does this also generate texture coordinates for opengl ?

    • Tanks :)

      For now, the tool takes an image and lets you define polygons over it. Therefore, it is not made to be used for dynamic opengl meshes. However, you can easily get the opengl texture coordinates if you need: indeed, the generated polygon coordinates are normalized in range [0, 100]. Just divide them by 100 and you get your texels.

      The next revision of the tool will be much more complete, and will feature both background images and opengl Texture mapped to the polygons. I’m sure you will enjoy it ;)

  • This is an amazing tool. Thanks for sharing this.

    I wonder how this is going to work with a map created by Tiled map editor.

    One problem I can see is that PDE does not work with packed image.

    In that case, it is going to be really hard to make them work together. Any advice/suggestion would be appreciated.

    • Don’t you have the raw images somewhere? I’m packing all my images, but I use PBE with unpacked content.

      I’ll try to add pack support in next revision, with built-in support for libgdx packs, but other frameworks (like cocos2d) won’t work out of the box so easily. I’ll see if I can come up with something easy to work with.

  • Aurélien

    May I ask when new version will be released? I am so looking forward to trying out new features such as defining joints.

    • I just released a new tool, Tween Studio (I’m currently writing a blog post about it), so I had no time to work on PBE. However, now that it’s done, I’ll go back to PBE. Can’t say when the new revision will be out, but it shouldn’t be very long since I already thought about all the features. It’s a matter of coding now.

  • [...] I googled an awesome offer and found out this physics-body editor. This appears like a exceptional equipment to automate the treatment I pointed out above. The [...]

  • i cant get this to work propear, i got it to save as xml ONCE, but when making a project i cant reopen it .. and edit and or add more later ?

    it dont really seem to let me add images or reopen exsisting … projects ? what am i doing wrong ?

    • Well… something?
      I can’t guess without any information :) Tell me what’s your system, 32b or 64b, if the demo projects (binary, json and xml) load correctly, and if you’re able to modify them.

    • I am aware, =) i do support on open source projects and code them on a few my self, i just did not know if you were “active” or not, Glad to see you are.

      from my current experiance is that when i browser to sellect the file sometimes it looks like

      ….path / to / file.png (this is when it works)

      sometimes just


      I cant figure out exactly what clicks do what. i am using win 7

      when it is not working in the list i do not see a name.. BUT i do see a item on the list but with no name.

    • Actually, the paths shown are relative to the current project file. If no project was created or loaded, the paths are absolute.

      If you see the file name only, I hope it’s because the image is in the project root folder.
      If you don’t see a path, then there is an issue, and not a small.

      You’re the first one to report something like that, I’ll investigate and deeply test the code.
      Be aware that this project is under an heavy update process, which will change it a lot. Therefore, the fixes will appear once the big update will be out (I maintain many projects at the same time, and it’s only spare-time projects…).

      Thanks for reporting.
      Can you please give me a tree of your project files, like:



  • problem may or may not have been that the image files was not located as a sub folder to the physics-body-editor ????


    now i am trying to use it, i am curently tryingit using FixtureAtlas

    02-15 18:22:29.705: E/AndEngine(31144): GueActivity.onCreateGame failed. @(Thread: ‘GLThread 10′)
    02-15 18:22:29.705: E/AndEngine(31144): java.lang.UnsatisfiedLinkError: newPolygonShape
    02-15 18:22:29.705: E/AndEngine(31144): at com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape(Native Method)
    02-15 18:22:29.705: E/AndEngine(31144): at com.badlogic.gdx.physics.box2d.PolygonShape.(
    02-15 18:22:29.705: E/AndEngine(31144): at org.andengine.extension.physics.box2d.FixtureAtlas.(

    i have modified it a bit, but only changing
    FixtureAtlas(FileHandle shapeFile)
    FixtureAtlas(InputStream stream)

    private final PolygonShape shape = new PolygonShape();

    seems to be the tricker. for the error have you experiance this ? or know what i need to do to resolve it ? i cant find anything on this on google.


    • Sorry for the late answer.

      It seems you’re having an issue that is in AndEngine side. A call to a native method (newPolygonShape) can’t reach the native library. Make sure you included every native library in your application.

      By the way, what is “org.andengine.extension.physics.box2d.FixtureAtlas” ? They included the FixtureAtlas in their library ?

  • I founed the problem for me, the last part of the was i was trying to do this before initilize the world.

  • Awesome job bro… thanks a lot for all your tools… I have a simple question… i want to change the center of the generated models, since i want to make it rotate (applying model.setAngularVelocity(2f);) but its center seems to be at the left bottom side… do you know some way to achieve that? Thanks a lot!

    • Thanks!

      The center of the generated models is the reference center (the one returned with body.getPosition() in box2d), not the mass center (the one returned with body.getWorldCenter()). The mass center is computed by box2d no matter where you place the reference center. This reference center shouldn’t have any impact on the behavior of the bodies.

      If you want to change this reference point, you have 2 options:

      1. Wait for PBE 3.0, which will let you choose this reference point,
      2. Modify the FixtureAtlas loader so every loaded vertex is translated by (-50, -50), since every saved models are normalized in a 100×100 square box.

  • Superb!! I changed the loader and worked

    Waiting for PBE 3 :)

    Thanks you very much! :D

  • I just wrote a loader for the Json export format of your tool :

    it’s not an “best practices in Java development” demonstration , but … it’s works fine for me !

    • Nice, thanks!

      For PBE 3.0, I decided to only support json format. XML is useless compared to json, and is 20 times longer to load compared to json. Binary is quick to load, but impossible to debug, and makes my life a hell each time I need to change the export format specification.

  • Once again…. thank you for this tool! i uploaded a game in the market yesterday, its called “Tilt Labyrinth: Neon Gravity” and this tool helped me a lot in order to make the “physic” tiles work.

    Waiting for PBE 3.0!

    Cheers from Argentina.

    • Hey, very nice! Me and my work mates had a nice time playing with it. I made a tweet to promote it.

      Work on PBE 3.0 has started again. I’m spending all my spare time on it. More news about it very soon ;-)

  • This is a cool tool.

    However, in windows 7 environment the latest version (physics-body-editor-2.9.1) does not have any options to save project or export in the various formats e.g. xml. I have tried your earlier version i.e. version 2.0 in windows 7 environment and the project can be saved in xml format.

    Unless I am not understanding the correct procedure to export in xml the above error renders the program unusable.

    It would be good if you correct this save/export option in the latest version.

    • I decided to drop support for binary and xml formats. Maintaining the compatibility for three formats is too much work for a free tool built as spare time project. Json is the only available format now. If you require xml, it should be very easy to write a translator from/to json.

      I made this choice because json has all the advantages of xml, requires a lot less bytes for the same output, and is much faster to parse. It is still a text format, so it can be easily edited (just use a prettifier before to indent it.

  • Hi Aurelien. Best regards

  • hey great too. could you add the basic rigid body and joints too?

  • I’m getting the following error while trying to load a jason file. Any ideas?

    BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal(“shapes.json”));

    Exception in thread “LWJGL Application” com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$
    Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J

    • What a plseaure to find someone who thinks through the issues

    • Thanks for contributing. It’s helped me understand the issues.

    • Ensar diyor ki:Ya ben anlamadım ÅŸato ile ilgili öykumu yazılacak ??ve sonrada gönderilcek.Herkes katılabilirmi acele cevap verseniz süper olur.Sizce: 1  1

    • Jeg er selv utrolig opslugt af serien “A Song of Ice and Fire” a RR Martin. Det er ogsÃ¥ opløftende af læse en bog, hvor alt ikke er sort og hvidt som f.eks. er kendetegnet for mange andre fantasy-bøger.Tak for et godt indlæg.

    • In both FIP and WAR (if you don’t know what these are, just Google them), the order of the rotation is the same:1. Shields2. Price3. Niemann4. Garza5. DavisxFIP has Garza ahead of Niemann, but I’m done being skeptical of Niemann. All his numbers scream lucky, but I can only watch so many hitters put weak contact on Niemann pitches before I finally start to think it’s more than luck.Ultimately though the order of the rotation in the regular season is pretty much irrelevant.

    • Thanks Camilla for this great link! I’ll buy this film because I think it will be difficult to see here in Spain (well, you never know!!!). I saw the screening and I’m sure it’s very interesting…women talking!!! That’s the best.

    • I have exactly what info I want. Check, please. Wait, it’s free? Awesome!

  • Hi, i’ve got a question: how can i draw the texture exactly on the body?

  • I was at first shocked and then giddy with excitement
    as I went and started catching hoppers. One big consideration is where you are going
    to store your boat and likely this will depend greatly on your budget.
    They are forms of storage that allow us to store and protect our food from bacterial growth and spoilage.

    my blog – marine refrigerator hp printer repairs miami

  • Women all over the country go out via the day so the norm, they will increasingly work located in what before certainly male
    dominated industries. The majority of people have a difficult
    time visualizing pictures and ideas. Whether you are looking for rompers, traditional clothes,
    personalized clothing, socks, shoes, hats and more, you can find the
    sweetest collection of baby boy dress clothes and more.

    Feel free to surf to my web blog; celebrity Dress up games Selena gomez

  • I have read so many articles or reviews about the blogger lovers but this post is
    actually a good piece of writing, keep it up.

  • [...] working on his game, he needed a tool for editing physics object bodies. He found the free Physics Body Editor but, unfortunately, it didn’t conveniently export physics data for Corona. His solution? [...]

  • [...] working on his game, he needed a tool for editing physics object bodies. He found the free Physics Body Editor but, unfortunately, it didn’t conveniently export physics data for Corona. His solution? [...]

Got anything to say? Go ahead and leave a comment!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>