I found great tool to make shapes. But the example how to load the shape for javascript. He wrote

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.

But I cannot find it easy at all :)

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);
}

So what to do with this line:

BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/test.json"));

BodyEditorLoader should be in jar file. But javascript cannot use this. Or I have to open jar file itselt and recode in javascritp?

Or maybe there exists something like this for javascritpt?

SPeed, it's seems to me that this is Java and not JavaScript.

Forgot to post a url of which I was talking about
http://www.aurelienribon.com/blog/projects/physics-body-editor/

SPeed, it's seems to me that this is Java and not JavaScript.

Yeah, but it generates JSON file, so it should be posible to get this json into javascript.

But anyway I will try another first which is for flash.

this flahs tool sucks - uses full CPU when moving mouse pointer. And exporting I think is only usfull that you can copy the coordinates. But I did not experiment much, because of annoing lag. The JAVA tool was much better for drawing those shapes.
Isn't there decent to to draw the shapes for javascript? Or convert from that JAVA json whihc it generates?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.