How 2 make a 360 raycast with a set number of rays

so im working on a DQN car ai and i want it to scan for obstacles within a 100 radius, im no math person so i dont know what im doing
currently i have this script right here

local function scanForObstacles(fov)
    local obstacles = {}
        
    for i = 1, NumOfRays do
        local angle = (i / NumOfRays) * math.rad(fov) - (math.rad(fov) / 2)
        local dir = Engine.CFrame * CFrame.Angles(0, angle, 0).LookVector
            
        local result = workspace:Raycast(Engine.Position, dir * 100, obstacleRaycastParams)
        debugRaycasts[i][1].WorldCFrame = CFrame.new(Engine.Position + dir * 100)
            
        table.insert(obstacles, getNumericalIDForObstacle(result))
    end
        
    return obstacles
end

idk if its my visualization at fault or the raycast itself,
but it shows that it doesnt do the job properly

image