local N=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local C=N("\067\097\109\101\114\097\083\116\097\116\101")local F=N("\083\117\109\109\101\100\067\097\109\101\114\097")local h=N("\103\101\116\082\111\116\097\116\105\111\110\073\110\088\090\080\108\097\110\101")local d={}d.ClassName="\088\090\080\108\097\110\101\076\111\099\107\067\097\109\101\114\097"function d.new(N)local C=setmetatable({},d)C.Camera=N or error("\078\111 \099\097\109\101\114\097")return C end function d.__add(C,N)return F.new(C,N)end function d.__index(F,N)if N=="\083\116\097\116\101"or N=="\067\097\109\101\114\097\083\116\097\116\101"or N=="\067\097\109\101\114\097"then local N=F.Camera.CameraState or F.Camera local d=h(N.CFrame)local K=C.new()K.CFrame=d K.FieldOfView=N.FieldOfView return K else return d[N]end end return d
--- Lock camera to only XZPlane, preventing TrackerCameras from making players sick.
-- @classmod XZPlaneLockCamera

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local CameraState = require("CameraState")
local SummedCamera = require("SummedCamera")
local getRotationInXZPlane = require("getRotationInXZPlane")

local XZPlaneLockCamera = {}
XZPlaneLockCamera.ClassName = "XZPlaneLockCamera"

function XZPlaneLockCamera.new(camera)
	local self = setmetatable({}, XZPlaneLockCamera)

	self.Camera = camera or error("No camera")

	return self
end

function XZPlaneLockCamera:__add(other)
	return SummedCamera.new(self, other)
end

function XZPlaneLockCamera:__index(index)
	if index == "State" or index == "CameraState" or index == "Camera" then
		local state = self.Camera.CameraState or self.Camera
		local xzrot = getRotationInXZPlane(state.CFrame)

		local newState = CameraState.new()
		newState.CFrame = xzrot
		newState.FieldOfView = state.FieldOfView

		return newState
	else
		return XZPlaneLockCamera[index]
	end
end

return XZPlaneLockCamera