I'm new to Box2D, but not to C# and programming.
I am trying to implement Box2D into my game engine and I am having a problem with collisions.
I set upp the world like this:
public World world;
world = new World(new Vector2(0, -10f), true);
Then I create a box and a rectangle.
BodyDef groundBodyDef = new BodyDef();
groundBodyDef.position = new Vector2(0.0f, -10.0f);
Body groundBody = world.CreateBody(groundBodyDef);
PolygonShape groundBox = new PolygonShape();
BodyDef boxBodyDef = new BodyDef();
boxBodyDef.position = new Vector2(0, 100);
boxBodyDef.type = BodyType.Dynamic;
Body boxBody = world.CreateBody(boxBodyDef);
PolygonShape boxBox = new PolygonShape();
After that in my game loop i take a step like this:
world.Step(1f / 60f, 6, 2);
When I am tracking the position of the dynamic objects I can se that they are moving.
And graphicly they are too. And the static object is static.
My problem is that the objects don't seem to collide. When i track the vertecies in the shapes the don't seem to move, while the position of the object does move.
This is what i mean:
The red squares are representing the vertecies of the shape/body.
What you can see is that the pink, orange and dark blue squares are passing through the light blue square and the black ground.
It seems like the world/simulator is not updating the bodies geometry, but is updating it's position.
Does anyone have any ideas what I could be doing wrong?