Hi,
I've recently been experimenting with JBox2D and JavaFX, and I like it. One thing that makes coding easier are builders. I've created some for my own convenience and I'd like to share them if someone is interested. Here's the pattern I used to create them:
http://88.198.17.44/blog/2012/04/06/bui ... heritance/In case you'd like this as a contribution, let me know. So far I've got RevoluteJointBuilder, CircleShapeBuilder, PolygonShapeBuilder, ChainShapeBuilder, BoxBuilder, but it's easy to create the rest. You can use them like this:
Body circle = new CircleShapeBuilder(world).position(0.2f, 1.4f).type(BodyType.STATIC).radius(.04f).build();
Body box = new BoxBuilder(world).position(0, 2.8f).restitution(.08f).halfWidth(2.7f).
halfHeight(world).angle(1.57079f).type(BodyType.STATIC).userData("wall").build();
new PolygonShapeBuilder(world).position(1.5f, 4.0f).type(BodyType.STATIC).
vertices(
new Vec2[]{
new Vec2(0, .7f),
new Vec2(.5f, .3f),
new Vec2(.5f, .5f),
new Vec2(0, 1.5f)
}).restitution(0.5f).friction(1).build();
I also added some convenience methods to make defining the vertices for Polygons less verbose, etc:
new PolygonShapeBuilder(world).position(0,0).type(BodyType.STATIC).vertices(
0.02f,0.0f, .02f,2f, 0.2f,2.2f, 0.02f,2.4f, 0.2f,2.6f, 0.4f,2.37f,
0.42f,2.45f, 0.1f,3.2f, 0.02f
).restitution(.08f).build();
In case you're interested, please let me know how to contribute. Keep up the good work and thanks for this project!
Toni