local function r(r,R,a,e,W)return((r-R)*(W-e))/(a-R)+e end local function R(r,R)local a=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera:ScreenPointToRay(r.X,r.Y)return a.Origin+a.Direction*R end local function a()local R=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera.ViewportSize.Y return r(R,0,2560,8,56)end return{R,a}
local function map(value, inMin, inMax, outMin, outMax)
	return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin
end

local function viewportPointToWorld(location, distance)
	local unitRay = game:GetService("Workspace").CurrentCamera:ScreenPointToRay(location.X, location.Y)
	return unitRay.Origin + unitRay.Direction * distance
end

local function getOffset()
	local viewportSizeY = game:GetService("Workspace").CurrentCamera.ViewportSize.Y
	return map(viewportSizeY, 0, 2560, 8, 56)
end

return { viewportPointToWorld, getOffset }
