-- Public methods


function CameraModifier:Destroy()
	self.CameraClass.Update = self.DefaultCamUpdate
	self.PopperClass.Update = self.DefaultPopUpdate
	self.BaseClass.UpdateMouseBehavior = self.DefaultMouseBehavior
end

function CameraModifier:OnCameraUpdate(this, dt)
	workspace.CurrentCamera.CFrame = self.LastCFrame
	workspace.CurrentCamera.Focus = self.LastFocus
	return self.DefaultCamUpdate(this, dt)
end

function CameraModifier:OnPopperUpdate(this, dt, dCamCF, dCamFocus)
	local camCF, focusCF
	if (self.WallStick.CameraMode == "Custom") then
		-- dCamCF and dCamFocus are in physics space
		local hrpCF, phrpCF = self.WallStick.HRP.CFrame, self.WallStick.PhysicsHRP.CFrame
		
		local camCF = hrpCF:ToWorldSpace(phrpCF:ToObjectSpace(dCamCF))
		local focusCF = hrpCF:ToWorldSpace(phrpCF:ToObjectSpace(dCamFocus))
		
		camCF, focusCF = self.DefaultPopUpdate(this, dt, camCF, focusCF) -- real space
		
		self.LastCFrame = phrpCF:ToWorldSpace(hrpCF:ToObjectSpace(camCF))
		self.LastFocus = phrpCF:ToWorldSpace(hrpCF:ToObjectSpace(focusCF))
		
		return camCF, focusCF
	else
		-- if mode is Default or Debug we do nothing special since the camera subject is where it needs to be
		local camCF, focusCF = self.DefaultPopUpdate(this, dt, dCamCF, dCamFocus)
		
		self.LastCFrame = camCF
		self.LastFocus = focusCF
		
		return camCF, focusCF
	end
end
