function cross(Y,E)return Vector3.new(Y.y*E.z-E.y*Y.z,Y.z*E.x-Y.x*E.z,Y.x*E.y-E.x*Y.y)end function dot(Y,E)return(Y.x*E.x+Y.y*E.y)+Y.z*E.z end function getLineSphereCollide(Y,E,k,L)local n=(E.x*E.x+E.y*E.y)+E.z*E.z local s=(E.x*(Y.x-k.x)+E.y*(Y.y-k.y))+E.z*(Y.z-k.z)local h=(((Y.x-k.x)*(Y.x-k.x)+(Y.y-k.y)*(Y.y-k.y))+(Y.z-k.z)*(Y.z-k.z))-L*L if n>0 and s*s>=n*h then local Y=math.sqrt(s*s-n*h)return(-s-Y)/n,(Y-s)/n else return-1,-1 end end

function cross(vector1, vector2)
	return Vector3.new(vector1.y * vector2.z - vector2.y * vector1.z, vector1.z * vector2.x - vector1.x * vector2.z, vector1.x * vector2.y - vector2.x * vector1.y)
end
function dot(vector1, vector2)
	return (vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z)
end
function getLineSphereCollide(linePoint1, lineVector, sphereCenter, radius)
	local a = lineVector.x * lineVector.x + lineVector.y * lineVector.y + lineVector.z * lineVector.z
	local b = lineVector.x * (linePoint1.x - sphereCenter.x) + lineVector.y * (linePoint1.y - sphereCenter.y) + lineVector.z * (linePoint1.z - sphereCenter.z)
	local c = (linePoint1.x - sphereCenter.x) * (linePoint1.x - sphereCenter.x) + (linePoint1.y - sphereCenter.y) * (linePoint1.y - sphereCenter.y) + (linePoint1.z - sphereCenter.z) * (linePoint1.z - sphereCenter.z) - radius * radius
	if (a > 0) and (b * b >= a * c) then
		local diff = math.sqrt(b * b - a * c)
		return ((-b - diff) / a), ((diff - b) / a)
	else
		return -1, -1
	end
end