function GJK.IsColliding(P)local p=(P.CentroidA-P.CentroidB).Unit local W={P.SupportA(P.SetA,p)-P.SupportB(P.SetB,-p)}p=-p for u=1,MAX_TRIES,1 do table.insert(W,P.SupportA(P.SetA,p)-P.SupportB(P.SetB,-p))if W[#W]:Dot(p)<=0 then return false else local u,Y=containsOrigin(P,W,p)if u then return true end p=Y end end return false end
-- Public Methods

function GJK:IsColliding()
	local direction = (self.CentroidA - self.CentroidB).Unit
	local simplex = { self.SupportA(self.SetA, direction) - self.SupportB(self.SetB, -direction) }

	direction = -direction

	for i = 1, MAX_TRIES do
		table.insert(simplex, self.SupportA(self.SetA, direction) - self.SupportB(self.SetB, -direction))

		if simplex[#simplex]:Dot(direction) <= 0 then
			return false
		else
			local passed, newDirection = containsOrigin(self, simplex, direction)

			if passed then
				return true
			end

			direction = newDirection
		end
	end

	return false
end
