function ScreenSpace.ScreenToWorldByHeight(K,q,H,r)local G=ScreenSpace.AspectRatio()local U=math.tan(math.rad(workspace.CurrentCamera.FieldOfView)/2)local v=G*U local M,c=ScreenSpace.ViewSizeX(),ScreenSpace.ViewSizeY()local P=-(c*r)/((H*2)*U)local X,Y=(K/M)*2-1,(q/c)*2-1 local a=(X*-v)*P local k=(Y*U)*P return Vector3.new(a,k,P)end
-- ScreenSpace -> WorldSpace. Taking a screen height that you want that object to be
-- and a world height that is the size of that object, and returning the position to
-- put that object at to satisfy those.
function ScreenSpace.ScreenToWorldByHeight(x, y, screenHeight, worldHeight)
	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 depth = -(sy * worldHeight) / (screenHeight * 2 * hfactor)
	--
	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)
end
