local h=game:GetService("\080\108\097\121\101\114\115")local L=game:GetService("\086\082\083\101\114\118\105\099\101")local x=(UserSettings()):GetService("\085\115\101\114\071\097\109\101\083\101\116\116\105\110\103\115")local T=require(script.Parent:WaitForChild("\067\097\109\101\114\097\073\110\112\117\116"))local m=require(script.Parent:WaitForChild("\067\097\109\101\114\097\085\116\105\108\115"))local B=require(script.Parent:WaitForChild("\086\082\066\097\115\101\067\097\109\101\114\097"))local P=setmetatable({},B)P.__index=P local D,M=pcall(function()return(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\070\108\097\103\069\110\097\098\108\101\086\082\085\112\100\097\116\101\051")end)function P.new()local h=setmetatable(B.new(),P)h.lastUpdate=tick()h:Reset()return h end function P.Reset(h)h.needsReset=true h.needsBlackout=true h.motionDetTime=0 h.blackOutTimer=0 h.lastCameraResetPosition=nil h.stepRotateTimeout=0 h.cameraOffsetRotation=0 h.cameraOffsetRotationDiscrete=0 end function P.Update(L,x)local T=workspace.CurrentCamera local m=T.CFrame local B=T.Focus local P=h.LocalPlayer local D=L:GetHumanoid()local M=T.CameraSubject if L.lastUpdate==nil or x>1 then L.lastCameraTransform=nil end L:StepZoom()L:UpdateFadeFromBlack(x)L:UpdateEdgeBlur(P,x)local X=L.lastSubjectPosition local e=L:GetSubjectPosition()if L.needsBlackout then L:StartFadeFromBlack()L.blackOutTimer=L.blackOutTimer+math.clamp(x,.0001,.1)if L.blackOutTimer>.1 and game:IsLoaded()then L.needsBlackout=false L.needsReset=true end end if e and(P and T)then local h=nil h=L:GetVRFocus(e,x)if L:IsInFirstPerson()then local T,P=L:UpdateFirstPersonTransform(x,m,h,X,e)m=T B=P else local T,P=L:UpdateThirdPersonTransform(x,m,h,X,e)m=T B=P end L.lastCameraTransform=m L.lastCameraFocus=B end L.lastUpdate=tick()return m,B end local X=D or M function P.UpdateFirstPersonTransform(L,m,B,P,D,M)if L.needsReset then L:StartFadeFromBlack()L.needsReset=false L.stepRotateTimeout=.25 L.VRCameraFocusFrozen=true L.cameraOffsetRotation=0 L.cameraOffsetRotationDiscrete=0 end if(D-M).magnitude>.01 then L:StartVREdgeBlur(h.LocalPlayer)end local e=P.p local C=L:GetCameraLookVector()if L.stepRotateTimeout>0 then L.stepRotateTimeout=L.stepRotateTimeout-m end local J=T.getRotation()local f=0 if X and x.VRSmoothRotationEnabled then f=J.X elseif L.stepRotateTimeout<=0 and math.abs(J.X)>.03 then f=.5 if J.X<0 then f=-0.5 end L.needsReset=true end B=CFrame.new(e-.5*L:CalculateNewLookVectorFromArg((Vector3.new(C.X,0,C.Z)).Unit,Vector2.new(f,0)),e)return B,P end function P.UpdateThirdPersonTransform(m,B,P,D,M,e)local C=m:GetCameraToSubjectDistance()if C<.5 then C=.5 end if M~=nil and m.lastCameraFocus~=nil then local J=(require((h.LocalPlayer:WaitForChild("\080\108\097\121\101\114\083\099\114\105\112\116\115")).PlayerModule:WaitForChild("\067\111\110\116\114\111\108\077\111\100\117\108\101"))):GetMoveVector()local f=true if not((M-e).magnitude>.01)then f=J.magnitude>.01 end if f then m.motionDetTime=.1 end m.motionDetTime=m.motionDetTime-B if m.motionDetTime>0 then f=true end if f and not m.needsReset then D=m.lastCameraFocus m.VRCameraFocusFrozen=true return P,D end local Y=true if m.lastCameraResetPosition~=nil then Y=(e-m.lastCameraResetPosition).Magnitude>1 end local a=T.getRotation()local s=X and a~=Vector2.new()local z=false if s and a.X~=0 then local h=m.cameraOffsetRotation+a.X if h<-math.pi then h=math.pi-(h+math.pi)elseif math.pi<h then h=-math.pi+(h-math.pi)end m.cameraOffsetRotation=math.clamp(h,-math.pi,math.pi)if x.VRSmoothRotationEnabled then m.cameraOffsetRotationDiscrete=m.cameraOffsetRotation local h=m:GetHumanoid()local L=h.Torso and h.Torso.CFrame.lookVector or Vector3.new(1,0,0)local x=D.Position-Vector3.new(L.X,0,L.Z)*C local T=Vector3.new(D.Position.X,x.Y,D.Position.Z)P=CFrame.new(T-(CFrame.new(x,T)*CFrame.fromAxisAngle(Vector3.new(0,1,0),m.cameraOffsetRotationDiscrete)).LookVector*(T-x).Magnitude,T)else local h=math.floor((m.cameraOffsetRotation*12)/12)if h~=m.cameraOffsetRotationDiscrete then m.cameraOffsetRotationDiscrete=h z=true end end end if not(not m.VRCameraFocusFrozen)and not(not Y)or not(not m.needsReset)or z then if not z then m.cameraOffsetRotationDiscrete=0 m.cameraOffsetRotation=0 end L:RecenterUserHeadCFrame()m.VRCameraFocusFrozen=false m.needsReset=false m.lastCameraResetPosition=e m:ResetZoom()m:StartFadeFromBlack()local h=m:GetHumanoid()local x=h.Torso and h.Torso.CFrame.lookVector or Vector3.new(1,0,0)local T=D.Position-Vector3.new(x.X,0,x.Z)*C local B=Vector3.new(D.Position.X,T.Y,D.Position.Z)if X and m.cameraOffsetRotation~=0 then T=B-(CFrame.new(T,B)*CFrame.fromAxisAngle(Vector3.new(0,1,0),m.cameraOffsetRotationDiscrete)).LookVector*(B-T).Magnitude end P=CFrame.new(T,B)end end return P,D end function P.EnterFirstPerson(h)h.inFirstPerson=true h:UpdateMouseBehavior()end function P.LeaveFirstPerson(h)h.inFirstPerson=false h.needsReset=true h:UpdateMouseBehavior()if h.VRBlur then h.VRBlur.Visible=false end end return P
-- Decompiled with the Synapse X Luau decompiler.

local l__Players__1 = game:GetService("Players")
local l__VRService__2 = game:GetService("VRService")
local l__UserGameSettings__3 = UserSettings():GetService("UserGameSettings")
local v4 = require(script.Parent:WaitForChild("CameraInput"))
local v5 = require(script.Parent:WaitForChild("CameraUtils"))
local v6 = require(script.Parent:WaitForChild("VRBaseCamera"))
local v7 = setmetatable({}, v6)
v7.__index = v7
local v8, v9 = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserFlagEnableVRUpdate3")
end)
function v7.new()
	local v10 = setmetatable(v6.new(), v7)
	v10.lastUpdate = tick()
	v10:Reset()
	return v10
end
function v7.Reset(p1)
	p1.needsReset = true
	p1.needsBlackout = true
	p1.motionDetTime = 0
	p1.blackOutTimer = 0
	p1.lastCameraResetPosition = nil
	p1.stepRotateTimeout = 0
	p1.cameraOffsetRotation = 0
	p1.cameraOffsetRotationDiscrete = 0
end
function v7.Update(p2, p3)
	local l__CurrentCamera__11 = workspace.CurrentCamera
	local v12 = l__CurrentCamera__11.CFrame
	local v13 = l__CurrentCamera__11.Focus
	local l__LocalPlayer__14 = l__Players__1.LocalPlayer
	local v15 = p2:GetHumanoid()
	local l__CameraSubject__16 = l__CurrentCamera__11.CameraSubject
	if p2.lastUpdate == nil or p3 > 1 then
		p2.lastCameraTransform = nil
	end
	p2:StepZoom()
	p2:UpdateFadeFromBlack(p3)
	p2:UpdateEdgeBlur(l__LocalPlayer__14, p3)
	local l__lastSubjectPosition__17 = p2.lastSubjectPosition
	local v18 = p2:GetSubjectPosition()
	if p2.needsBlackout then
		p2:StartFadeFromBlack()
		p2.blackOutTimer = p2.blackOutTimer + math.clamp(p3, 0.0001, 0.1)
		if p2.blackOutTimer > 0.1 and game:IsLoaded() then
			p2.needsBlackout = false
			p2.needsReset = true
		end
	end
	if v18 and l__LocalPlayer__14 and l__CurrentCamera__11 then
		local v19 = nil
		v19 = p2:GetVRFocus(v18, p3)
		if p2:IsInFirstPerson() then
			local v20, v21 = p2:UpdateFirstPersonTransform(p3, v12, v19, l__lastSubjectPosition__17, v18)
			v12 = v20
			v13 = v21
		else
			local v22, v23 = p2:UpdateThirdPersonTransform(p3, v12, v19, l__lastSubjectPosition__17, v18)
			v12 = v22
			v13 = v23
		end
		p2.lastCameraTransform = v12
		p2.lastCameraFocus = v13
	end
	p2.lastUpdate = tick()
	return v12, v13
end
local u1 = v8 or v9
function v7.UpdateFirstPersonTransform(p4, p5, p6, p7, p8, p9)
	if p4.needsReset then
		p4:StartFadeFromBlack()
		p4.needsReset = false
		p4.stepRotateTimeout = 0.25
		p4.VRCameraFocusFrozen = true
		p4.cameraOffsetRotation = 0
		p4.cameraOffsetRotationDiscrete = 0
	end
	if (p8 - p9).magnitude > 0.01 then
		p4:StartVREdgeBlur(l__Players__1.LocalPlayer)
	end
	local l__p__24 = p7.p
	local v25 = p4:GetCameraLookVector()
	if p4.stepRotateTimeout > 0 then
		p4.stepRotateTimeout = p4.stepRotateTimeout - p5
	end
	local v26 = v4.getRotation()
	local v27 = 0
	if u1 and l__UserGameSettings__3.VRSmoothRotationEnabled then
		v27 = v26.X
	elseif p4.stepRotateTimeout <= 0 and math.abs(v26.X) > 0.03 then
		v27 = 0.5
		if v26.X < 0 then
			v27 = -0.5
		end
		p4.needsReset = true
	end
	p6 = CFrame.new(
		l__p__24 - 0.5 * p4:CalculateNewLookVectorFromArg(Vector3.new(v25.X, 0, v25.Z).Unit, Vector2.new(v27, 0)),
		l__p__24
	)
	return p6, p7
end
function v7.UpdateThirdPersonTransform(p10, p11, p12, p13, p14, p15)
	local v28 = p10:GetCameraToSubjectDistance()
	if v28 < 0.5 then
		v28 = 0.5
	end
	if p14 ~= nil and p10.lastCameraFocus ~= nil then
		local v29 = require(
			l__Players__1.LocalPlayer:WaitForChild("PlayerScripts").PlayerModule:WaitForChild("ControlModule")
		):GetMoveVector()
		local v30 = true
		if not ((p14 - p15).magnitude > 0.01) then
			v30 = v29.magnitude > 0.01
		end
		if v30 then
			p10.motionDetTime = 0.1
		end
		p10.motionDetTime = p10.motionDetTime - p11
		if p10.motionDetTime > 0 then
			v30 = true
		end
		if v30 and not p10.needsReset then
			p13 = p10.lastCameraFocus
			p10.VRCameraFocusFrozen = true
			return p12, p13
		end
		local v31 = true
		if p10.lastCameraResetPosition ~= nil then
			v31 = (p15 - p10.lastCameraResetPosition).Magnitude > 1
		end
		local v32 = v4.getRotation()
		local v33 = u1 and v32 ~= Vector2.new()
		local v34 = false
		if v33 and v32.X ~= 0 then
			local v35 = p10.cameraOffsetRotation + v32.X
			if v35 < -math.pi then
				v35 = math.pi - (v35 + math.pi)
			elseif math.pi < v35 then
				v35 = -math.pi + (v35 - math.pi)
			end
			p10.cameraOffsetRotation = math.clamp(v35, -math.pi, math.pi)
			if l__UserGameSettings__3.VRSmoothRotationEnabled then
				p10.cameraOffsetRotationDiscrete = p10.cameraOffsetRotation
				local v36 = p10:GetHumanoid()
				local v37 = v36.Torso and v36.Torso.CFrame.lookVector or Vector3.new(1, 0, 0)
				local v38 = p13.Position - Vector3.new(v37.X, 0, v37.Z) * v28
				local v39 = Vector3.new(p13.Position.X, v38.Y, p13.Position.Z)
				p12 = CFrame.new(
					v39
						- (CFrame.new(v38, v39) * CFrame.fromAxisAngle(
								Vector3.new(0, 1, 0),
								p10.cameraOffsetRotationDiscrete
							)).LookVector
							* (v39 - v38).Magnitude,
					v39
				)
			else
				local v40 = math.floor(p10.cameraOffsetRotation * 12 / 12)
				if v40 ~= p10.cameraOffsetRotationDiscrete then
					p10.cameraOffsetRotationDiscrete = v40
					v34 = true
				end
			end
		end
		if not not p10.VRCameraFocusFrozen and not not v31 or not not p10.needsReset or v34 then
			if not v34 then
				p10.cameraOffsetRotationDiscrete = 0
				p10.cameraOffsetRotation = 0
			end
			l__VRService__2:RecenterUserHeadCFrame()
			p10.VRCameraFocusFrozen = false
			p10.needsReset = false
			p10.lastCameraResetPosition = p15
			p10:ResetZoom()
			p10:StartFadeFromBlack()
			local v41 = p10:GetHumanoid()
			local v42 = v41.Torso and v41.Torso.CFrame.lookVector or Vector3.new(1, 0, 0)
			local v43 = p13.Position - Vector3.new(v42.X, 0, v42.Z) * v28
			local v44 = Vector3.new(p13.Position.X, v43.Y, p13.Position.Z)
			if u1 and p10.cameraOffsetRotation ~= 0 then
				v43 = v44
					- (CFrame.new(v43, v44) * CFrame.fromAxisAngle(
							Vector3.new(0, 1, 0),
							p10.cameraOffsetRotationDiscrete
						)).LookVector
						* (v44 - v43).Magnitude
			end
			p12 = CFrame.new(v43, v44)
		end
	end
	return p12, p13
end
function v7.EnterFirstPerson(p16)
	p16.inFirstPerson = true
	p16:UpdateMouseBehavior()
end
function v7.LeaveFirstPerson(p17)
	p17.inFirstPerson = false
	p17.needsReset = true
	p17:UpdateMouseBehavior()
	if p17.VRBlur then
		p17.VRBlur.Visible = false
	end
end
return v7
