local U=game:GetService("\080\108\097\121\101\114\115")local A=game:GetService("\067\111\108\108\101\099\116\105\111\110\083\101\114\118\105\099\101")local o do local U,A=pcall(function()return(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\080\111\112\112\101\114\099\097\109\076\111\111\115\101\079\112\097\099\105\116\121\084\104\114\101\115\104\111\108\100")end)o=U and A end local K=game.Workspace.CurrentCamera local B=math.min local x=math.tan local S=math.rad local Q=math.huge local s=Ray.new local function G(U,A)for A=#U,A+1,-1 do U[A]=nil end end local Y,P,Z do local function U()local U=S(K.FieldOfView)local A=K.ViewportSize local o=A.X/A.Y Z=2*x(U/2)P=o*Z end;(K:GetPropertyChangedSignal("\070\105\101\108\100\079\102\086\105\101\119")):Connect(U);(K:GetPropertyChangedSignal("\086\105\101\119\112\111\114\116\083\105\122\101")):Connect(U)U()Y=K.NearPlaneZ;(K:GetPropertyChangedSignal("\078\101\097\114\080\108\097\110\101\090")):Connect(function()Y=K.NearPlaneZ end)end local h={}do local o={}local function K()h={unpack(A:GetTagged("\073\103\110\111\114\101\067\097\109\101\114\097"))}local U=#h+1 for A,o in pairs(o)do h[U]=o U=U+1 end end local function B(U)K()end local function x(U)local function A(A)o[U]=A K()end local function B()o[U]=nil K()end U.CharacterAdded:Connect(A)U.CharacterRemoving:Connect(B)if U.Character then A(U.Character)end end local function S(U)o[U]=nil K()end;(A:GetInstanceAddedSignal("\073\103\110\111\114\101\067\097\109\101\114\097")):Connect(B);(A:GetInstanceRemovedSignal("\073\103\110\111\114\101\067\097\109\101\114\097")):Connect(B)U.PlayerAdded:Connect(x)U.PlayerRemoving:Connect(S)for U,A in next,A:GetTagged("\073\103\110\111\114\101\067\097\109\101\114\097")do B(A)end for U,A in ipairs(U:GetPlayers())do x(A)end K()end
--------------------------------------------------------------------------------
-- Popper.lua
-- Prevents your camera from clipping through walls.
--------------------------------------------------------------------------------

local Players = game:GetService("Players")
local Collection = game:GetService("CollectionService")

local FFlagUserPoppercamLooseOpacityThreshold
do
	local success, enabled = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserPoppercamLooseOpacityThreshold")
	end)
	FFlagUserPoppercamLooseOpacityThreshold = success and enabled
end

local camera = game.Workspace.CurrentCamera

local min = math.min
local tan = math.tan
local rad = math.rad
local inf = math.huge
local ray = Ray.new

local function eraseFromEnd(t, toSize)
	for i = #t, toSize + 1, -1 do
		t[i] = nil
	end
end

local nearPlaneZ, projX, projY
do
	local function updateProjection()
		local fov = rad(camera.FieldOfView)
		local view = camera.ViewportSize
		local ar = view.X / view.Y

		projY = 2 * tan(fov / 2)
		projX = ar * projY
	end

	camera:GetPropertyChangedSignal("FieldOfView"):Connect(updateProjection)
	camera:GetPropertyChangedSignal("ViewportSize"):Connect(updateProjection)

	updateProjection()

	nearPlaneZ = camera.NearPlaneZ
	camera:GetPropertyChangedSignal("NearPlaneZ"):Connect(function()
		nearPlaneZ = camera.NearPlaneZ
	end)
end

local blacklist = {}
do
	local charMap = {}

	local function refreshIgnoreList()
		blacklist = { unpack(Collection:GetTagged("IgnoreCamera")) }
		local n = #blacklist + 1
		for _, character in pairs(charMap) do
			blacklist[n] = character
			n = n + 1
		end
	end

	local function OnIgnoreCollectionUpdated(instance)
		refreshIgnoreList()
	end

	local function playerAdded(player)
		local function characterAdded(character)
			charMap[player] = character
			refreshIgnoreList()
		end
		local function characterRemoving()
			charMap[player] = nil
			refreshIgnoreList()
		end

		player.CharacterAdded:Connect(characterAdded)
		player.CharacterRemoving:Connect(characterRemoving)
		if player.Character then
			characterAdded(player.Character)
		end
	end

	local function playerRemoving(player)
		charMap[player] = nil
		refreshIgnoreList()
	end

	Collection:GetInstanceAddedSignal("IgnoreCamera"):Connect(OnIgnoreCollectionUpdated)
	Collection:GetInstanceRemovedSignal("IgnoreCamera"):Connect(OnIgnoreCollectionUpdated)
	Players.PlayerAdded:Connect(playerAdded)
	Players.PlayerRemoving:Connect(playerRemoving)

	for _, instance in next, Collection:GetTagged("IgnoreCamera") do
		OnIgnoreCollectionUpdated(instance)
	end
	for _, player in ipairs(Players:GetPlayers()) do
		playerAdded(player)
	end
	refreshIgnoreList()
end
