diff --git a/World.cpp b/World.cpp index a7f7bf1..8f37c24 100644 --- a/World.cpp +++ b/World.cpp @@ -267,7 +267,10 @@ void World::render(sf::RenderWindow& window) } else if (rayAngle > 360) { rayAngle -= 360; } - float obstacleScale = worldToCamera / castRay(player.x, player.y, rayAngle); + float obstacleScale = worldToCamera / ( + castRay(player.x, player.y, rayAngle) * + cosf(deltaAngle*deg_to_rad) + ); /* 2 Is wall height in meters. */ fillColumn(window, i, obstacleScale); }