I’m putting together a simple wrapper library for JBox2D (it’s awesome) that attempts to make it a bit easier to use (a-la Phys2D). So far it simply supports bodies with compound shapes and some basic physics but the code does end up looking pretty simple:
World world = new World();
Body body = new Body(new Circle(10.0f), 0, 0);
world.add(body);
Body floor = new Body(new Rectangle(200.0f, 10.0f), 0, -50.0f, true);
world.add(floor);
world.addListener(new WorldListener() {
@Override
public void collided(CollisionEvent event) {
System.out.println("Collision");
}
@Override
public void separated(CollisionEvent event) {
System.out.println("Separate");
}
});
for (int i=0;i<4000;i++) {
world.update(0.01f);
}
If anyone’s interested the code is available here: https://bob.newdawnsoftware.com/repos/slick/trunk/fizzy/
And there’s an initial jar here: http://www.cokeandcode.com/fizzy/demo/fizzy.jar
And there’s rather an indulgent logo that I did because I like logos:
Comments appreciated,
Kev