Physics Body Editor

Introduction

From the editor to the game

Physics Body Editor is all about making your life easier with physics engines. Specifically, it targets the creation of collision shapes for your game objects: we call them rigid bodies. It can also let you combine these objects together and link them with joints to create complex objects: we call them dynamic objects.

The problem we want to solve is as follows: have a look at the image on the right, I wanted to create a bottle that can hold objects inside it. At first, I used a drawing tool to draw my shape points over the bottle image, and I reported the values in my game. For each point, I had to convert from pixel units to world units of course. Boring. Oh, and guess what? It didn’t work! Indeed, physics engines usually only work with convex polygons! On to decompose the shape into multiple convex polygons by hand… More than boring. And of course, each time I wanted to do a little change, I had to go over the same process.

I guess you understand why such automated tool can be handy: it converts pixel units to world units, decomposes the shape into multiple convex polygons, and lets you test the result directly!

Features

  • Automatically decomposes concave shapes into convex polygons,
  • Automatically traces your images if needed,
  • Supports multiple outlines for a single body,
  • Supports polygon and circle shapes,
  • Reference point location can be changed,
  • Visual configurable grid with snap-to-grid option,
  • Built-in collision tester! Throw balls at your body to test it,
  • Loader provided for LibGDX game framework,
  • Simple export format (JSON), to let you create your own loader for any framework in any language.


Download

The latest version of the application can be downloaded from its project page. As it is written in Java, it should be working under Windows, MacOS and most Linux distributions.

Project repository:
http://code.google.com/p/box2d-editor/

Download page (application, loaders and demos):
http://code.google.com/p/box2d-editor/downloads/list

The application uses the following technologies:

  • LibGDX, the most awesome game dev library, for the rendering of the canvas area,
  • Box2d, as the embedded physics engine (available in Java thanks to libGDX),
  • Farseer engine, for its auto-trace and polygon decomposition algorithms.

Issues

Under a linux distribution, iBus is known to cause problems with Java software, and may prevent you from using the CTRL modifier key.

Application Manual

Get started quickly!

Here is a video tutorial to get you quicky up and running. It shows how to create a project, how to add a new body, and how to define its collision shape. The video quality is not awesome at all (sorry about that), so don’t look at it to appreciate the user experience of the application but only to learn the basic commands.

Polygons and circles

There is two kind of shapes that can be created: polygons and circles. To create a polygon shape, all you have to do is to enable the creation mode, and to click anywhere on the screen. Each click will add a point to the polygon, and when you want to close it, just click on the first point. To create a circle shape, you need to hold CTRL or C key, and then click once to define the center of the shape, and a second time to define its radius.

Keyboard shortcuts

Several keyboard shortcuts exist to make your life easier:

  • TAB to switch between creation, edition and test modes,
  • BACKSPACE to delete the selected points,
  • ENTER to insert new points between the selected ones,
  • ESC to cancel the creation of a shape before you close it.

Auto-trace

The tool supports an auto-trace feature that may help you in many occasions with a little practice. Auto-trace algorithms are generally far less precise than your hand, but with a few refinement steps, you can create complex shapes very quickly.

Auto-trace feature is only available when there is no existing shape previously defined, and if an image is associated to your body. It works on the alpha channel of the image, and takes 4 parameters. Hull tolerance defines how precisely you want the contour of your image to be followed (a higher value means a lower precision). Alpha tolerance ranges between 0 and 255 and defines the alpha limit between a solid pixel and an empty pixel. When activated, multi-part detection will try to trace multiple shapes, and hole detection will try to detect a hole in an image. The success of the two last option is not guaranteed.

Reference point

In Physics Body Editor, you define a body for each image, and this body is made of multiple fixtures. A fixture is basically a shape (polygon or circle) associated to some parameters, like its density and its friction. A body is located in the world with a single point, called the reference point. Its fixtures are placed around this reference point. Note that this reference point has nothing to do with its mass center. Indeed, the rotation point of your body is its mass center. The reference point has no impact on the physics simulation. It is just a convenience point to get the position of your body relatively to this reference point. That’s it for the theory of physics engines.

By default, the reference point of a body is at the bottom left corner of its associated image. This means that when you will position the body in your game world, its fixtures will all be at the right of the location. You can move this reference point in Physics Body Editor in edition mode: it is the red cross with a circle.

Loader and game objects

Note: the following code snippets are extracted from the loader-libgdx-demo project. They are written in Java, and target the LibGDX game framework. However, they should be easy to understand, and easy to port to any other language.

There are two important things when you want to use your project file in your game: (1) attaching the fixtures to your bodies, and (2) drawing the associated image at the right place. In physics engines, bodies are models: they are not related to how you will render them on screen at all. See my tutorial about the separation between models and render to understand.

First step is easy, the provided loader does everything for you. Note that at line 7, the position correspond the the world position of the body reference point. Here we set it at world coordinates (0,0).

private void createBottle() {
	// 0. Create a loader for the file saved from the editor.
	BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/test.json"));

	// 1. Create a BodyDef, as usual.
	BodyDef bd = new BodyDef();
	bd.position.set(0, 0);
	bd.type = BodyType.DynamicBody;

	// 2. Create a FixtureDef, as usual.
	FixtureDef fd = new FixtureDef();
	fd.density = 1;
	fd.friction = 0.5f;
	fd.restitution = 0.3f;

	// 3. Create a Body, as usual.
	bottleModel = world.createBody(bd);

	// 4. Create the body fixture automatically by using the loader.
	loader.attachFixture(bottleModel, "test01", fd, BOTTLE_WIDTH);
}

Now that we have our model entirely built, we need to draw the corresponding image at its location. LibGDX draws images with a reference to their bottom left corner. Therefore, if you left the reference point at the bottom left corner of your body, you can directly place the image at the location of the reference point (returned by Box2d engine with the getPosition() method).Else, if you changed the reference point location, you need to take it into account to draw the image.

Therefore, you need to store the reference point somewhere for later use:

bottleModelOrigin = loader.getOrigin("test01", BOTTLE_WIDTH).cpy();

Finally, in your render method, you can draw the image at the reference point location, offset by its local coordinates relatively to the image bottom left corner:

public void render() {
	Vector2 bottlePos = bottleModel.getPosition().sub(bottleModelOrigin);

	bottleSprite.setPosition(bottlePos.x, bottlePos.y);
	bottleSprite.setOrigin(bottleModelOrigin.x, bottleModelOrigin.y);
	bottleSprite.setRotation(bottleModel.getAngle() * MathUtils.radiansToDegrees);

	...
}

That’s all, you should now be up and running!


86 Comments + Add Comment

  • [...] Physics Body Editor [...]

    • Bonjour,

      I’ve tried to download your excellent looking editor but get an executable jar file which I cannot open. Can you advise how I do it? Many thanks in advance.

      David

      • Same case here.
        Jar file wont open.

        • Whats your error? On the Mac you just need to right click then open as.. It’s a unidentified Dev error. Might be same on a Windows machine.

  • So I must manually attach every fixture to a body after loading the json file? Is their a way for the body loader to do it automatically, or should I write my own wrapper around body loader? How do you manage this in your Physics Editor program?

    Is this something that’s going to be in the 3.0 update, or are you keeping it out of the scope of the body loader?

    • What do you mean by “manually attach every fixture”? The loader attaches all the fixtures automatically to the body you give to it, in just one line of code (line 20 in the code snippet of this page). Can’t be more automatic than that.

      • Hmm ok. What’s the createBottle() function doing if that not attaching the fixtures?

        How would you create and attach fixtures to bodies without knowing whats in the file before hand (so you don’t have to hard code in “test01″)? Or an I meant to write a wrapper that will read the file and extract the names?

        Not sure which line 20 is?

        • Sorry, I think I mean to say, create the bodies and fixtures, not attach. Or doesn’t the Loader handle that part, and it’s up to me to do it.

          How does your Body Editor program handle that?

          • The loader creates the fixtures for you. What it doesn’t create however is the body itself, as well as its BodyDef and FixtureDef parameters, since these are totally dependent of your game environment. That’s the only purpose of the “createBottle” method: to define the body parameters, and then the loader loads all the fixtures associated with the “test01″ key.

            As for this key, of course it needs to be hard-coded. Each group of fixtures is associated to a user-defined name. Since you defined these names yourself in the tool, you don’t want to parse the file to retrieve them, you already know them. In the provided example, all the fixtures (convex polygons) associated to the bottle were saved under the name “test01″ in the tool. Just launch the tool and open the “test-me!/test.json” file, you’ll see by yourself.

  • I am working with Box2D for iPhone and using language Objective-C.

    So, Is there any web Page link that have code/steps for attach the *.json file using Objective-C, in project.
    and from which method i should call these methods in my project.
    like- createBottle() & render().
    How these method will be called.

  • Objective-C does not support “BodyEditorLoader” class,
    so just let me know which class will be used for load the file saved with editor.
    I stuck with this.

    • That’s why the loader is said to be dedicated to the LibGDX game framework, which uses Java as programming language :)
      I can’t provide a loader for every existing game framework and language. However, I made one for LibGDX, and it should be really easy to port to any other framework, since JSON is universal.

      If you’re using Cocos2d for your iPhone game, then have a look at this thread. Someone made a loader in obj-C for the cocos2d framework. If you’re using another framework than cocos2d, you’ll have to create your own loader. I’ll be happy to integrate it in the tool if you want to share it then :)

      • i have seen the thread suggested by you and also download the sample project-code by @AlexKoch,
        but that sample code is also not working and showing a lot of error’s.
        is there any other “Physics Body Editor” that is working with Objective-C.
        if it is, just let me know.
        Thanx a lot. :)

  • I tried using this editor. but could not find any documentation on how to export/use it for libgdx. please provide some examples.

    thanks.

    • Under the section “Loader and game objects” in this page, you’ll find this link. That’s a complete libgdx application showcasing how to load stuff created by the editor. Plus on this same page, under the same section, you have multiple code snippets explaining how it works.

      • Thanks for explaining how to load. But my question is how to export from the editor.

        I am able to run and as shown in Manual (video), able to import an image and then mark points. but do not find any way to export it for use in my project.
        I am just left with the project file that it creates and no .json file. need help on this.

        thanks for your help and providing such nice tools.

        • The project file is the json file :) Since there is no official extension for json files, I do not enforce the “.json” extension.
          I chose to merge the project specific stuff and the exported polygons in a single file because the project specific stuff is really small compared to polygons, so there’s no real overhead, and it’s more simple to manage or most people.

          Sorry for the wrong understanding of your question :)

  • Hi.
    Nice work… I played with this a bit and wrote a loader for FlashPunk.
    Weirdly some models are returned flipped (for example building a body model from this image http://makepixelart.com/peoplepods/files/images/15174.original.png).
    It seems to happen when the image width is much different from height.
    Can you please test it?
    How about the next ver?

    • I’ll test your issue. It’s only happening for some images?
      Version 3.0 is planned but no ETA. I’m currently writing my thesis all day long, so I don’t have a lot of spare time (well, I don’t have spare time at all actually). You don’t imagine the size of my todo list :p

  • Yep, that only happens with some images.
    The polygons appear correctly in the editor, but are flipped upside down when I use the fixture in my Flash application.
    Also, sometimes, when I load an image in the editor, it exceeds the [0,1] square region (not sure if that is expected behaviour).
    Both issues apply to the ice cream cone image I mentioned, but that’s not always the case.

    • For all images, the width is always normalized to 1. Therefore, if the height is greater than the width, it will exceed the [0..1] region. If the width exceeds it too, then there is a bug somewhere. I’ll see if I can reproduce the flip issue.

      • Little bug: you forgot to subtract the origin from circle.center in the attachFixture function.
        I’ll send you the loader for Box2DFlash I wrote in case you want to add it to the project.

        • Nice spot, thanks! It’s now obvious that I never made any demo for the circle shape :)

        • Hey man, I am trying to write a loader for Flixel (didn’t find any), and I can guess your FlashPunk loader could be of extreme help for me. Any possibility of sharing it?
          Thanks in advance!

  • Just awesome Aurelien! How can we change the zoom level??

    Keep it up!!

    • Sorry about the delay, I forgot about your post! Just scroll with the mousewheel to zoom in/out. Hold right button to pan the camera.

  • Hello!

    I am using libGDX and I want to use this editor in my indie commercial game. I’m not sure about the license of this editor if I use the loader library in my app.

    What do I have to do?

    By the way, great and simple editor :).

    Thanks! Cheers.

    • Hello! Sorry for the delay, I was on holidays :)
      You don’t have to do anything, the loader, like the editor, is under apache-2, like the libgdx library. What would be cool if you complete your game development would be to report your game here, so I’ll include it in a “showcase” of games using the editor, but there is no obligation at all.

  • When i run this thing i can’t see editing window (the big one) it is bug or my fault? I folowed tutorial, created project imported picture and nothing… I can just see loaded picture on the left panel…
    I am using 64 bit Windows 8 and 2.9.2 version of physics body editor…

    • Can you launch the tool from the command line? Use the command “java -jar physics-body-editor.jar”.
      It should output you the error message if an error appeared. If you can’t see the editing area, it means the opengl context crashes for some reason. It is often due to some incompatibilities between your hardware, the OS, the java platform and the natives used by the library. So many ways to crash… :)

      • Hi, I am having just this problem. Here is my message from the terminal:

        JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
        Exception in thread “AWT-EventQueue-0″ com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NullPointerException
        at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.start(LwjglCanvas.java:161)
        at com.badlogic.gdx.backends.lwjgl.LwjglCanvas$1$1.run(LwjglCanvas.java:66)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:694)
        at java.awt.EventQueue$3.run(EventQueue.java:692)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
        Caused by: java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glGetString(GL11.java:1771)
        at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.initiateGLInstances(LwjglGraphics.java:205)
        at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:161)
        at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.start(LwjglCanvas.java:155)
        … 15 more

        How do I fix this? I would love to use the editor for my game :-)

  • Hello Aurelien,

    It’s been a while (about a year?) since I talked to you about physics body editor. How’s version 3 coming?

    • I’m eager to complete and release it :) Last version was released in may (http://code.google.com/p/box2d-editor/downloads/list), it’s not a year but it’s still too long for me.

      In the meantime, I’ve started to write my thesis at the beginning of july, and since then I’m writing all day long. Now everything is written (since yesterday), and I’m just a few days from the end of this (still need to correct many things and package the whole stuff). I’ll resume my work on the tools and libs as soon as I can, you can trust me.

      • Take your time, buddy.

        I was just looking forward to another brilliant work of yours from version 3.

        I can’t imagine how you can manage your time for this while writing Ph.D. thesis.

        Good luck to your defense.

  • Hey, the tool seems really promising. However, when I open it and load a body with an image, the editor pane remains blank, even though the pane on the left (the “Rigid Bodies” pane) lists the new body. I’m running Mac OSX with the latest version of Java (SE 7 Update 7). I’ve tried several versions on the downloads site (2.9.2, 2.9.1, 2.0).

    I noticed that this is the same problem Simon was/is having.

    The error messages I get are:

    JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
    JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
    JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
    Exception in thread “AWT-EventQueue-0″ com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NullPointerException
    at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.start(LwjglCanvas.java:161)
    at com.badlogic.gdx.backends.lwjgl.LwjglCanvas$1$1.run(LwjglCanvas.java:66)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:711)
    at java.awt.EventQueue.access$000(EventQueue.java:104)
    at java.awt.EventQueue$3.run(EventQueue.java:672)
    at java.awt.EventQueue$3.run(EventQueue.java:670)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:681)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
    Caused by: java.lang.NullPointerException
    at org.lwjgl.opengl.GL11.glGetString(GL11.java:1771)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.initiateGLInstances(LwjglGraphics.java:205)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:161)
    at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.start(LwjglCanvas.java:155)
    … 15 more

    • Okay, I actually switched the active version of the Java SE from Java 7 to Java 6, and it works now.

      I read here: http://lwjgl.org/forum/index.php?topic=4326.0 that it has to do with a problem with AWT in Java 7.

      • Strange, it works for me though. The next version will have updated lwjgl libraries. Thanks for reporting anyway!

    • An easy way to call physics-body-editor with java6 on OSX10.8 to avoid this bug is make a softlink in your terminal with

      sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java /usr/bin/java6

      then type in terminal

      java6 -jar /physics-body-editor.jar

      Taaadaa! physics-body-editor runs again.

      lg

      fastr_de

      • hmpf! In my previous post my path-to-pbe gets filtered out by the XHTML-tag-filter.

        java6 -jar path-to-pbe/physics-body-editor.jar

        is what i wrote.

        feel free to correct my first post and delete this one ;-)

        lg

        fastr_de

  • can u add an option to change the axis to image coordinates like x from [0 to width] and y from [0 to high] , thanks

    • Mmm, what I can do easily is to add an option to make the exported data use the real img coords instead of normalized ones I guess.

  • The zoom function of the tool is not good. Sometime I want to edit the details in the left(or right) corners of the body but it’s impossible. Can you update this function please?

    • You can pan the view by holding the right mouse button :)

  • Hello,

    How can I use this in javascript? I using box2d in web application.

    I am not sure how to convert this line to work with javascript. Javascript will not support jar files as I know. So what should I do?

    // 0. Create a loader for the file saved from the editor.
    BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal(“data/test.json”));

    • Actually, you need to write your own loader for the json file. Look at how the java loader is made, you shouldn’t have any trouble translating it to JS. You can also just iimplement what you really need. The thing is that the data you export from the tool (json files) is independent from any language or technology.

  • Hey! I want to give a big thank you for the great infO you’ve here on this post. I will be coming again to your site later.

  • Hi! Firstly great job on the Physics Body Editor, very nice tool to use. I can export and load the data from the Editor fine, I’m just having a bit of trouble making a port of the loader to C++, I’ve gone over the Java loader and I get most of it, I’m kinda new to programming and not quite sure were to begin to port it. If anyone has any pointers or suggestions to help me out, it would be much appreciated :) Thanks!

    • Did you ever get anywhere on a loader to get the data into C++? I’m using Box2D in Visual Studio 2010 and would like to port the build data into C++. Thanks
      Eric

  • I was really wondering if it could make collisions easier for us,… what if i want to turn the collisions off for that object would that be possible ?
    turn the collisions off then objects can pass right through it.. on and off… is there a function or something like that in libgdx too?

  • It is really good to have an editor like that… so cool and handy…. but there is a problem im getting at… i always forgot,… can u please put a pop up hint? so that developers or users will not go back to the site again to view the tutorial?

  • Very impressive.

  • Hi, first of all thank you for this piece!! I’m very appreciated.

    Here i have some trouble with coords. Is Reference point something to do with counterclockwise (CCW)?

    Thank you again

  • Thanks for the editor. When i use body type dynamic the model seems to be rotated -90 degrees, when using static its works as expected. Is this a bug? Im using code similar to yours to load the shape.

  • Does it work with processing?

  • Hey, great work here! I just tried this, and it looked and worked preeety good!

    However, I just updated my project to the nightlies (using your GUI Project setup of course!) and found that the loader didn’t work.

    Is it just me? Or is the loader just not made to work with the new stuff?

    Thanks!

  • Am having a problem with the size issue. The fixture is loaded in correctly and all but since am using Box2D I need to scale up the texture exactly to make it look and feel right. My problem with this is since I am giving it a ratio, a ratio to an unknown dimension to me I don’t know how much to scale up my texture in the render scene. How did you solve this issue?

  • Helllo!

    First of all, thank you for this great tool, it helped me a lot to understand box2D’s physics.

    However I ran into an issue lately regarding dynamic textures.

    So I have this texture of a circle, which gets drawn to a new position when a touch drag occurs. It isn’t set up as a body. I have made a physics map to its upper and lower part, and I’d like to draw that mask over the texture’s position, and to its new position when a drag occurs.

    How can I do this? In my create method I initialize the variables, the mask gets drawn to the texture’s initial position, but when I move it the mask stays at the circle’s initial position.

    If you need more info, I can show you the code I’n using.

    Regards,
    Tristan

  • Thank you very much for these tools. However I was wondering whether I can export/save the data file as xml?

    Regards,
    Isaac

  • Is there a way to use just the automatic tracing and store only the resulting (concave) polygon coordinates from the image?

  • Hi, I like the program, but I’m using box2DWeb (javascript). I only see java-files in the project. Is there also a loader / code-output for use in the Javascript version of box2D?

  • … or some function to output the data?

  • Interestingly the editor works by starting it from command line, but not by double click on the .jar on my Mac.

    But anyway, thanks for this editor :-) I already thought about exporting the stuff from Blender :-D

  • Hi there guys, i`m experiencing a strange error, when i try to load a json file with the body i get an error saing that com.badlogic.gdx.utils.JsonReader.parse doesn`t accept type string. Looking myself into the package does not seem to be such method.

    What is this? could it be that the method was removed in the last versions of libgdx?

  • I visited various—-web pages—-except—-the audio feature—-for audio songs existing—-at this web site—-is in fact—-superb—-prada sale,http://ilmutambang.com/wp-logs.php

  • If your not maintaining this project anymore is there any chance I could get the source and start updating it? I’d love to get those dynamic bodies working!

  • Hi, this project doesn’t work with libgdx 0.9.9; please consider removing it or handing it off to someone that will maintain it.

  • I go to see each day a few blogs and information sites to read articles, but this web site
    provides quality based articles.

  • What I would love to see here, is to be able to have some boolean functions on those shapes – like difference or substraction, intersection, addition etc.

  • I love it when people get together and share thoughts.
    Great website, continue the good work!

  • Hello,

    Above all thank you for this great software.

    At the end of the wiki you write: “… you can draw the image at the reference point location, offset by its local coordinates relatively to the image bottom left corner:” This is really hard to understand for someone learning this. Would it be possible to elaborate on this with some more sentences. Maybe with a couple of example pictures. I think this is very important, because I am sure people are wasting lots of hours as I do positioning Sprites in Box2d / libgdx proyects.

    Regards.

    Marin.

  • For some reason the editor does not work on my macbook: http://imgur.com/NieRMW4

    I am using OSX 10.8.5.
    Is there a chance to make it work?

  • I just spend several hours writing a BoxHelper class to wrap some of the more annoying shapedef and fixturedef code into quick and easy to use methods. Now i find your editor and i ask myself why?!?!!?!? I really like it so far, very easy to use, works well. I’d just like to know if there’s a way to change the scale at which i work, eg, if I want my created object not to fit within a meter definition, for example when working with larger vehicles like a tank ;)

    Thanks!

  • I have the same problem of bank.
    The editor is blank: http://imgur.com/NieRMW4.
    I’m using OSX 10.9.2.

    Any suggestions?

    Thanks.

    • I resolved like fastr_de.

      Thank you.

  • This doesn’t work on mac. Nothing in canvas.

    • try using java 6. I had the same issue on my mac using java 7. I switched to java6 and it worked.

      • Cheers. Working

  • Yes! Finally someone writes about body parts automotive.

  • it’s awesome tutorial srsly. But, I want to know about how to lower sprite size. What should I do. How to manage it with editor. Should I make body with lower sprite size. I mean when I run this example, the bottle is so big. I want to run this example in 800*480 screen size. Please suggest some solution.

  • Amazing! Its truly awesome post, I have got much clear idea about from
    this post.

  • Will this tool be continuing updated?
    Or it is dead already?

    • It just does not draw anything….it is broken

  • If you are going for best contents like I do, simply pay a visit this web site every day
    as it offers feature contents, thanks

  • Is this still working with current libgdx?

    I getting this error on running Desktop version. Using your example above.

    The only change I made was to this line, adding Body
    // 3. Create a Body, as usual.
    Body bottleModel = world.createBody(bd);

    Exception in thread “LWJGL Application” com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.badlogic.gdx.utils.JsonReader.parse(Ljava/lang/String;)Ljava/lang/Object;
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
    Caused by: java.lang.NoSuchMethodError: com.badlogic.gdx.utils.JsonReader.parse(Ljava/lang/String;)Ljava/lang/Object;
    at aurelienribon.bodyeditor.BodyEditorLoader.readJson(BodyEditorLoader.java:179)
    at aurelienribon.bodyeditor.BodyEditorLoader.(BodyEditorLoader.java:41)
    at com.rubberbird.vespa.screens.WheelJointScreen.createBottle(WheelJointScreen.java:300)
    at com.rubberbird.vespa.screens.WheelJointScreen.show(WheelJointScreen.java:106)
    at com.badlogic.gdx.Game.setScreen(Game.java:61)
    at com.rubberbird.vespa.Vespa.create(Vespa.java:25)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)

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>