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={}h.ClassName="\080\111\105\110\116\067\097\109\101\114\097"function h.new(N,C)local F=setmetatable({},h)F.OriginCamera=N or error("\077\117\115\116 \104\097\118\101 \111\114\105\103\105\110\067\097\109\101\114\097")F.FocusCamera=C or error("\077\117\115\116 \104\097\118\101 \102\111\099\117\115\067\097\109\101\114\097")return F end function h.__add(C,N)return F.new(C,N)end function h.__newindex(F,N,C)if N=="\079\114\105\103\105\110\067\097\109\101\114\097"or N=="\070\111\099\117\115\067\097\109\101\114\097"then rawset(F,N,C)else error(N.." \105\115 \110\111\116 \097 \118\097\108\105\100 \109\101\109\098\101\114 \111\102 \080\111\105\110\116\067\097\109\101\114\097")end end function h.__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,h=F.Origin,F.Focus local d=C.new()d.FieldOfView=N.FieldOfView+h.FieldOfView d.CFrame=CFrame.new(N.Position,h.Position)return d elseif N=="\070\111\099\117\115"then return F.FocusCamera.CameraState elseif N=="\079\114\105\103\105\110"then return F.OriginCamera.CameraState else return h[N]end end return h
--- Point a current element
-- @classmod PointCamera

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

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

local PointCamera = {}
PointCamera.ClassName = "PointCamera"

--- Initializes a new PointCamera
-- @constructor
-- @param originCamera A camera to use
-- @param focusCamera The Camera to look at.
function PointCamera.new(originCamera, focusCamera)
	local self = setmetatable({}, PointCamera)

	self.OriginCamera = originCamera or error("Must have originCamera")
	self.FocusCamera = focusCamera or error("Must have focusCamera")

	return self
end

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

function PointCamera:__newindex(index, value)
	if index == "OriginCamera" or index == "FocusCamera" then
		rawset(self, index, value)
	else
		error(index .. " is not a valid member of PointCamera")
	end
end

function PointCamera:__index(index)
	if index == "State" or index == "CameraState" or index == "Camera" then
		local origin, focus = self.Origin, self.Focus

		local state = CameraState.new()
		state.FieldOfView = origin.FieldOfView + focus.FieldOfView
		state.CFrame = CFrame.new(origin.Position, focus.Position)

		return state
	elseif index == "Focus" then
		return self.FocusCamera.CameraState
	elseif index == "Origin" then
		return self.OriginCamera.CameraState
	else
		return PointCamera[index]
	end
end

return PointCamera