function cross(l,O)return Vector3.new(l.y*O.z-O.y*l.z,l.z*O.x-l.x*O.z,l.x*O.y-O.x*l.y)end function dot(l,O)return(l.x*O.x+l.y*O.y)+l.z*O.z end function getLineSphereCollide(l,O,h,A)local K=(O.x*O.x+O.y*O.y)+O.z*O.z local Q=(O.x*(l.x-h.x)+O.y*(l.y-h.y))+O.z*(l.z-h.z)local f=(((l.x-h.x)*(l.x-h.x)+(l.y-h.y)*(l.y-h.y))+(l.z-h.z)*(l.z-h.z))-A*A if K>0 and Q*Q>=K*f then local l=math.sqrt(Q*Q-K*f)return(-Q-l)/K,(l-Q)/K else return-1,-1 end end
------------------------------------------------------------------------------------Raycasting functions
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
