Fixed world borders not being aligned properly

This commit is contained in:
Maximilian Giller 2023-06-10 18:53:57 +02:00
parent 041a565ae1
commit b3d793cb9f

View file

@ -49,11 +49,11 @@ void MapSimulation::constructSquareObstacle(float minX, float minY, float maxX,
{
b2BodyDef bodyDef;
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);
b2PolygonShape shape;
shape.SetAsBox(maxX - minX, maxY - minY);
shape.SetAsBox((maxX - minX) / 2.f, (maxY - minY) / 2.f);
b2FixtureDef fixtureDef;
fixtureDef.shape = &shape;