function GJK.IsColliding(G)local E=(G.CentroidA-G.CentroidB).Unit local x={G.SupportA(G.SetA,E)-G.SupportB(G.SetB,-E)}E=-E for S=1,MAX_TRIES,1 do table.insert(x,G.SupportA(G.SetA,E)-G.SupportB(G.SetB,-E))if x[#x]:Dot(E)<=0 then return false else local S,w=containsOrigin(G,x,E)if S then return true end E=w end end return false end


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
