public World() {
   collisionConfiguration = new btDefaultCollisionConfiguration();
   dispatcher = new btCollisionDispatcher(collisionConfiguration);
   broadphase = new btDbvtBroadphase();
   solver = new btSequentialImpulseConstraintSolver();
   dynamicsWorld =
       new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
   dynamicsWorld.setGravity(gravity);
 }
    @Override
    public void dispose() {
      for (int i = 0; i < entities.size; i++) {
        final Entity entity = entities.get(i);
        dynamicsWorld.removeRigidBody(entity.body);
        entity.dispose();
      }
      entities.clear();

      for (Entity.ConstructInfo constructor : constructors.values()) {
        constructor.dispose();
      }
      constructors.clear();

      dynamicsWorld.delete();
      solver.delete();
      broadphase.delete();
      dispatcher.delete();
      collisionConfiguration.delete();
    }
    public void update() {
      dynamicsWorld.stepSimulation(Gdx.graphics.getDeltaTime(), 5);

      GL10 gl = Gdx.gl10;

      for (int i = 0; i < entities.size; i++) {
        final Entity entity = entities.get(i);
        gl.glPushMatrix();
        gl.glMultMatrixf(entity.worldTransform.transform.val, 0);
        gl.glColor4f(entity.color.r, entity.color.g, entity.color.b, entity.color.a);
        entity.mesh.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
      }
    }
 public void add(final Entity entity) {
   entities.add(entity);
   dynamicsWorld.addRigidBody(entity.body);
 }