-- Class


local Portal = {}
Portal.__index = Portal

function Portal.new(humanoid, windowA, windowB, cameraModule)
	local self = setmetatable({}, Portal)
	
	self.Humanoid = humanoid
	self.HRP = humanoid.RootPart
	self.LastPosition = self.HRP.Position
	self.TeleportTick = tick()
	
	self.WindowA = windowA
	self.WindowB = windowB
	
	self.World = nil
	self.WorldLookupA = {}
	self.WorldLookupB = {}
	self.CharacterLookups = {}
	
	self.Sky = nil
	self.SkyA = nil
	self.SkyB = nil
	
	self.CameraModule = cameraModule
	self.LastCameraCFrame = workspace.CurrentCamera.CFrame
	self.LastCameraFocus = workspace.CurrentCamera.Focus
	
	RUNSERVICE:BindToRenderStep("PortalBeforeInput", Enum.RenderPriority.Input.Value - 1, function(dt)
		workspace.CurrentCamera.CFrame = self.LastCameraCFrame
		workspace.CurrentCamera.Focus = self.LastCameraFocus
	end)
	
	RUNSERVICE:BindToRenderStep("PortalAfterCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
		self:OnAfterCameraStep(dt)
	end)
	
	return self
end
