function ScreenSpace.ScreenToWorldByHeightDepth(M,O,y,K)local e=ScreenSpace.AspectRatio()local d=math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)local P=e*d local h,o=ScreenSpace.ViewSizeX(),ScreenSpace.ViewSizeY()local i=((-(y/o)*2)*d)*K local v,C=(M/h)*2-1,(O/o)*2-1 local L=(v*-P)*K local X=(C*d)*K return Vector3.new(L,X,K),i end
-- ScreenSpace -> WorldSpace. Taking a screen height, and a depth to put an object
-- at, and returning a size of how big that object has to be to appear that size
-- at that depth.
function ScreenSpace.ScreenToWorldByHeightDepth(x, y, screenHeight, depth)
	local aspectRatio = ScreenSpace.AspectRatio()
	local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView) / 2)
	local wfactor = aspectRatio * hfactor
	local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
	--
	local worldHeight = -(screenHeight / sy) * 2 * hfactor * depth
	--
	local xf, yf = x / sx * 2 - 1, y / sy * 2 - 1
	local xpos = xf * -wfactor * depth
	local ypos = yf * hfactor * depth
	--
	return Vector3.new(xpos, ypos, depth), worldHeight
end
