public IPhysicsBody CreateRectangleWall(int x, int y, int width, int height, ICollider userData) { var fixDef = new FixtureDef(); fixDef.density = 1; fixDef.friction = 1; fixDef.restitution = .6; var bodyDef = new BodyDef(); bodyDef.type = BodyType.STATIC; bodyDef.position.x = this.PixelToMeter(x) + this.PixelToMeter(width) / 2; bodyDef.position.y = this.PixelToMeter(y) + this.PixelToMeter(height) / 2; PolygonShape polyShape; fixDef.shape = polyShape = new PolygonShape(); polyShape.setAsBox(this.PixelToMeter(width) / 2d, this.PixelToMeter(height) / 2d); var body = this.World.createBody(bodyDef); body.createFixture(fixDef); body.setUserData(userData); return(new PhysicsBody(body)); }