function PopperCam.Update(I)if PopperEnabled then local I=Camera.Focus.p local b=Camera.CoordinateFrame local V=b.p+b.lookVector*NEAR_CLIP_PLANE_OFFSET local p=Camera.ViewportSize local h={game.Workspace:WaitForChild("\068\101\098\114\105\115")}if Camera and(Camera.CameraSubject and Camera.CameraSubject.Parent)then table.insert(h,Camera.CameraSubject.Parent)end for I,b in pairs(PlayerCharacters)do table.insert(h,b)end for I,b in pairs(VehicleParts)do table.insert(h,b)end local t=0 for b,i in pairs(CAST_SCREEN_SCALES)do local Z=ScreenToWorld(p*i,p,NEAR_CLIP_PLANE_OFFSET)local F=I+(Z-V)local T,C=PiercingCast(F,Z,h)local o=(C-Z).Magnitude if o>t then t=o end end local i=(b.p-I).Magnitude if math.abs(i-LastZoomLevel)>.001 then LastPopAmount=0 end local Z=math.max(t,LastPopAmount)if Z>0 then Camera.CoordinateFrame=b+b.lookVector*Z LastPopAmount=math.max(0,Z-POP_RESTORE_RATE)end LastZoomLevel=i end end
-------------------------
--| Exposed Functions |--
-------------------------

function PopperCam:Update()
	if PopperEnabled then
		-- First, prep some intermediate vars
		local focusPoint = Camera.Focus.p
		local cameraCFrame = Camera.CoordinateFrame
		local cameraFrontPoint = cameraCFrame.p + (cameraCFrame.lookVector * NEAR_CLIP_PLANE_OFFSET)
		local screenSize = Camera.ViewportSize
		local ignoreList = { game.Workspace:WaitForChild("Debris") }
		if Camera and Camera.CameraSubject and Camera.CameraSubject.Parent then
			table.insert(ignoreList, Camera.CameraSubject.Parent)
		end
		for _, character in pairs(PlayerCharacters) do
			table.insert(ignoreList, character)
		end
		for _, basePart in pairs(VehicleParts) do
			table.insert(ignoreList, basePart)
		end

		-- Cast rays at the near clip plane, from corresponding points near the focus point,
		-- and find the direct line that is the most cut off
		local largest = 0
		for _, screenScale in pairs(CAST_SCREEN_SCALES) do
			local clipWorldPoint = ScreenToWorld(screenSize * screenScale, screenSize, NEAR_CLIP_PLANE_OFFSET)
			local rayStartPoint = focusPoint + (clipWorldPoint - cameraFrontPoint)
			local _, hitPoint = PiercingCast(rayStartPoint, clipWorldPoint, ignoreList)
			local cutoffAmount = (hitPoint - clipWorldPoint).Magnitude
			if cutoffAmount > largest then
				largest = cutoffAmount
			end
		end

		-- Then check if the player zoomed since the last frame,
		-- and if so, reset our pop history so we stop tweening
		local zoomLevel = (cameraCFrame.p - focusPoint).Magnitude
		if math.abs(zoomLevel - LastZoomLevel) > 0.001 then
			LastPopAmount = 0
		end

		-- Finally, zoom the camera in (pop) by that most-cut-off amount, or the last pop amount if that's more
		local popAmount = math.max(largest, LastPopAmount)
		if popAmount > 0 then
			Camera.CoordinateFrame = cameraCFrame + (cameraCFrame.lookVector * popAmount)
			LastPopAmount = math.max(0, popAmount - POP_RESTORE_RATE) -- Shrink it for the next frame
		end

		LastZoomLevel = zoomLevel
	end
end
