'Fix warp in recaster (lua)

function RENDER_RAY(plr,rayNumber,Ray_Distance,RayAmount,rayAngle)
    local theta = plr.angle - FOV/2
    local diss = Ray_Distance * math.cos(math.rad(theta - plr.angle))

    local screenWidth = love.graphics.getWidth()
    local screenHeight = love.graphics.getHeight()
    local colorDistance = (255 - diss/1.5)/255
    if colorDistance > 0 then
        love.graphics.setColor(colorDistance,colorDistance,colorDistance,1)
    else
        love.graphics.setColor(0,0,0,1)
    end
    local wallHeight = math.Clamp(screenHeight-diss, 0 , 99999999)
    love.graphics.rectangle("fill",(screenWidth/RayAmount) * rayNumber,(screenHeight/2)- 
    allHeight/2,screenWidth/RayAmount,wallHeight)
end

(using love2d)

this is the function that renders the Columbs. its called every time a new ray is casted, so the function is only dealing with 1 ray at a time.

plr is just the plr object that contains the (x,y,angle) of the player everything like plr.angle and RayAngle is just the standard math.rad and ray_distance is just the distance from the ray HIT x y and the player x y

as you can see iv tried fixing the warping but its not going away Iv tried to find a good solution but the best one i could find has no effect on the warping!

Screenshots:

1

2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source