0

I have window 640x480. I use 4 static bodies as edge of window, so nothing can't move over the edge of window. This is one of the 4 bodies, 30 pixels represent one meter, all of the bodies are programmed with following method, but at right edge is space.

BodyDef leftDef = new BodyDef();
leftDef.type = BodyType.STATIC;
leftDef.position.set(0, 480/30);
PolygonShape leftShape = new PolygonShape();
leftShape.setAsBox(0, 1000);        
Body left = world.createBody(leftDef);
FixtureDef leftFixture = new FixtureDef();
leftFixture.density = 1;
leftFixture.restitution = 0f;
leftFixture.shape = leftShape;
left.createFixture(leftFixture);


glOrtho(0, 640, 0, 480, 1, -1); // glOrtho setting

Sorry, but I can't post images so what can cause that space?

kubaj
  • 63
  • 1
  • 7
  • [link](http://www.imagehosting.cz/?v=beznzvzvz.jpg) Here you can see space between dynamic body move to right top corner – kubaj Jan 29 '13 at 20:15

1 Answers1

0

I forgotten add "f" in this line

leftDef.position.set(0, 480/30);

so code must be

leftDef.position.set(0, 480/30f);

Now everything work good

kubaj
  • 63
  • 1
  • 7