Fixed world borders not being aligned properly
This commit is contained in:
parent
041a565ae1
commit
b3d793cb9f
1 changed files with 2 additions and 2 deletions
|
@ -49,11 +49,11 @@ void MapSimulation::constructSquareObstacle(float minX, float minY, float maxX,
|
||||||
{
|
{
|
||||||
b2BodyDef bodyDef;
|
b2BodyDef bodyDef;
|
||||||
bodyDef.type = b2_staticBody;
|
bodyDef.type = b2_staticBody;
|
||||||
bodyDef.position.Set((maxX - minX) / 2.f, (maxY - minY) / 2.f);
|
bodyDef.position.Set((maxX + minX) / 2.f, (maxY + minY) / 2.f);
|
||||||
b2Body *body = world->CreateBody(&bodyDef);
|
b2Body *body = world->CreateBody(&bodyDef);
|
||||||
|
|
||||||
b2PolygonShape shape;
|
b2PolygonShape shape;
|
||||||
shape.SetAsBox(maxX - minX, maxY - minY);
|
shape.SetAsBox((maxX - minX) / 2.f, (maxY - minY) / 2.f);
|
||||||
|
|
||||||
b2FixtureDef fixtureDef;
|
b2FixtureDef fixtureDef;
|
||||||
fixtureDef.shape = &shape;
|
fixtureDef.shape = &shape;
|
||||||
|
|
Loading…
Reference in a new issue