[LWJGL] Box2D Ground Collision not working anymore?

Hi,

I am learning JBox2D using Oskar’s tutorials (http://www.youtube.com/watch?v=ZKJC2cloIqc),

and I’ve come across an issue (or maybe I’m a bit thick and I’ve missed something obvious)

In the tutorial Oskar sets the code up like this:

glOrtho(0, 320, 0, 240, 1, -1);

but I need to use it like this

glOrtho(0, 320, 240, 0, 1, -1);

So I’ve managed to flip everything up the right way I believe, except for the ground. It doesnt seem to render in the right place or the box doesnt collide with it.

Here is the render code for the ground:

        BodyDef groundDef = new BodyDef();
        groundDef.position.set(0, height);
        groundDef.type = BodyType.STATIC;
        PolygonShape groundShape = new PolygonShape();
        groundShape.setAsBox(1000, 0);
        Body ground = world.createBody(groundDef);
        FixtureDef groundFixture = new FixtureDef();
        groundFixture.density = 1;
        groundFixture.restitution = 0.3f;
        groundFixture.shape = groundShape;
        ground.createFixture(groundFixture);
        bodies.add(ground);

and here is a link to the rest of the code if you want:
http://pastebin.java-gaming.org/e8f9408558e

Thanks,

  • Dan