local Y=require(script.Parent:WaitForChild("\090\111\111\109\067\111\110\116\114\111\108\108\101\114"))local F={}do F.__index=F local Y=CFrame.new()local function W(Y)local F,W=Y:toAxisAngle()return F*W end local function m(F)local W=F.magnitude if W>1e-05 then return CFrame.fromAxisAngle(F,W)end return Y end local function A(Y)local F,W,m,A,l,e,B,b,g,x,v,G=Y:components()return CFrame.new(0,0,0,A,l,e,B,b,g,x,v,G)end function F.new()return setmetatable({lastCFrame=nil},F)end function F.Step(l,Y,F)local e=l.lastCFrame or F l.lastCFrame=F local B=F.p local b=A(F)local g=e.p local x=A(e)local v=(B-g)/Y local G=W(b*x:inverse())/Y local function I(Y)local F=v*Y+B local W=m(G*Y)*b return W+F end return{extrapolate=I,posVelocity=v;rotVelocity=G}end function F.Reset(Y)Y.lastCFrame=nil end end
--[[
	Poppercam - Occlusion module that brings the camera closer to the subject when objects are blocking the view.
--]]

local ZoomController = require(script.Parent:WaitForChild("ZoomController"))

local TransformExtrapolator = {}
do
	TransformExtrapolator.__index = TransformExtrapolator

	local CF_IDENTITY = CFrame.new()

	local function cframeToAxis(cframe)
		local axis, angle = cframe:toAxisAngle()
		return axis * angle
	end

	local function axisToCFrame(axis)
		local angle = axis.magnitude
		if angle > 1e-5 then
			return CFrame.fromAxisAngle(axis, angle)
		end
		return CF_IDENTITY
	end

	local function extractRotation(cf)
		local _, _, _, xx, yx, zx, xy, yy, zy, xz, yz, zz = cf:components()
		return CFrame.new(0, 0, 0, xx, yx, zx, xy, yy, zy, xz, yz, zz)
	end

	function TransformExtrapolator.new()
		return setmetatable({
			lastCFrame = nil,
		}, TransformExtrapolator)
	end

	function TransformExtrapolator:Step(dt, currentCFrame)
		local lastCFrame = self.lastCFrame or currentCFrame
		self.lastCFrame = currentCFrame

		local currentPos = currentCFrame.p
		local currentRot = extractRotation(currentCFrame)

		local lastPos = lastCFrame.p
		local lastRot = extractRotation(lastCFrame)

		-- Estimate velocities from the delta between now and the last frame
		-- This estimation can be a little noisy.
		local dp = (currentPos - lastPos) / dt
		local dr = cframeToAxis(currentRot * lastRot:inverse()) / dt

		local function extrapolate(t)
			local p = dp * t + currentPos
			local r = axisToCFrame(dr * t) * currentRot
			return r + p
		end

		return {
			extrapolate = extrapolate,
			posVelocity = dp,
			rotVelocity = dr,
		}
	end

	function TransformExtrapolator:Reset()
		self.lastCFrame = nil
	end
end
