function LegacyCamera.SetCameraToSubjectDistance(T,P)return BaseCamera.SetCameraToSubjectDistance(T,P)end function LegacyCamera.Update(T,P)if not T.cameraType then return end local N=tick()local p=N-T.lastUpdate local b=workspace.CurrentCamera local Q=b.CFrame local d=b.Focus local k=PlayersService.LocalPlayer local e=T:GetHumanoid()local F=b and b.CameraSubject local O=F and F:IsA("\086\101\104\105\099\108\101\083\101\097\116")local x=F and F:IsA("\083\107\097\116\101\098\111\097\114\100\080\108\097\116\102\111\114\109")local w=e and e:GetState()==Enum.HumanoidStateType.Climbing if T.lastUpdate==nil or p>1 then T.lastDistanceToSubject=nil end local h=T:GetSubjectPosition()if T.cameraType==Enum.CameraType.Fixed then if T.lastUpdate then local P=math.min(.1,N-T.lastUpdate)local p=T:UpdateGamepad()T.rotateInput=T.rotateInput+p*P end if h and(k and b)then local P=T:GetCameraToSubjectDistance()local N=T:CalculateNewLookVector()T.rotateInput=ZERO_VECTOR2 d=b.Focus Q=CFrame.new(b.CFrame.p,b.CFrame.p+P*N)end elseif T.cameraType==Enum.CameraType.Attach then if h and b then local P=T:GetCameraToSubjectDistance()local p=T:GetHumanoid()if T.lastUpdate and(p and p.RootPart)then local P=math.min(.1,N-T.lastUpdate)local b=T:UpdateGamepad()T.rotateInput=T.rotateInput+b*P local Q=p.RootPart.CFrame.lookVector local d=Util.GetAngleBetweenXZVectors(Q,T:GetCameraLookVector())if Util.IsFinite(d)then T.rotateInput=Vector2.new(d,T.rotateInput.Y)end end local b=T:CalculateNewLookVector()T.rotateInput=ZERO_VECTOR2 d=CFrame.new(h)Q=CFrame.new(h-P*b,h)end elseif T.cameraType==Enum.CameraType.Watch then if h and(k and b)then local P=nil local N=T:GetHumanoid()if N and N.RootPart then local N=h-b.CFrame.p P=N.unit if T.lastDistanceToSubject and T.lastDistanceToSubject==T:GetCameraToSubjectDistance()then local P=N.magnitude T:SetCameraToSubjectDistance(P)end end local p=T:GetCameraToSubjectDistance()local k=T:CalculateNewLookVector(P)T.rotateInput=ZERO_VECTOR2 d=CFrame.new(h)Q=CFrame.new(h-p*k,h)T.lastDistanceToSubject=p end else return b.CFrame,b.Focus end T.lastUpdate=N return Q,d end return LegacyCamera
--[[ Functions overridden from BaseCamera ]]
--
function LegacyCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
	return BaseCamera.SetCameraToSubjectDistance(self, desiredSubjectDistance)
end

function LegacyCamera:Update(dt)
	-- Cannot update until cameraType has been set
	if not self.cameraType then
		return
	end

	local now = tick()
	local timeDelta = (now - self.lastUpdate)
	local camera = workspace.CurrentCamera
	local newCameraCFrame = camera.CFrame
	local newCameraFocus = camera.Focus
	local player = PlayersService.LocalPlayer
	local humanoid = self:GetHumanoid()
	local cameraSubject = camera and camera.CameraSubject
	local isInVehicle = cameraSubject and cameraSubject:IsA("VehicleSeat")
	local isOnASkateboard = cameraSubject and cameraSubject:IsA("SkateboardPlatform")
	local isClimbing = humanoid and humanoid:GetState() == Enum.HumanoidStateType.Climbing

	if self.lastUpdate == nil or timeDelta > 1 then
		self.lastDistanceToSubject = nil
	end
	local subjectPosition = self:GetSubjectPosition()

	if self.cameraType == Enum.CameraType.Fixed then
		if self.lastUpdate then
			-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
			local delta = math.min(0.1, now - self.lastUpdate)
			local gamepadRotation = self:UpdateGamepad()
			self.rotateInput = self.rotateInput + (gamepadRotation * delta)
		end

		if subjectPosition and player and camera then
			local distanceToSubject = self:GetCameraToSubjectDistance()
			local newLookVector = self:CalculateNewLookVector()
			self.rotateInput = ZERO_VECTOR2

			newCameraFocus = camera.Focus -- Fixed camera does not change focus
			newCameraCFrame = CFrame.new(camera.CFrame.p, camera.CFrame.p + (distanceToSubject * newLookVector))
		end
	elseif self.cameraType == Enum.CameraType.Attach then
		if subjectPosition and camera then
			local distanceToSubject = self:GetCameraToSubjectDistance()
			local humanoid = self:GetHumanoid()
			if self.lastUpdate and humanoid and humanoid.RootPart then
				-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
				local delta = math.min(0.1, now - self.lastUpdate)
				local gamepadRotation = self:UpdateGamepad()
				self.rotateInput = self.rotateInput + (gamepadRotation * delta)

				local forwardVector = humanoid.RootPart.CFrame.lookVector

				local y = Util.GetAngleBetweenXZVectors(forwardVector, self:GetCameraLookVector())
				if Util.IsFinite(y) then
					-- Preserve vertical rotation from user input
					self.rotateInput = Vector2.new(y, self.rotateInput.Y)
				end
			end

			local newLookVector = self:CalculateNewLookVector()
			self.rotateInput = ZERO_VECTOR2

			newCameraFocus = CFrame.new(subjectPosition)
			newCameraCFrame = CFrame.new(subjectPosition - (distanceToSubject * newLookVector), subjectPosition)
		end
	elseif self.cameraType == Enum.CameraType.Watch then
		if subjectPosition and player and camera then
			local cameraLook = nil

			local humanoid = self:GetHumanoid()
			if humanoid and humanoid.RootPart then
				local diffVector = subjectPosition - camera.CFrame.p
				cameraLook = diffVector.unit

				if self.lastDistanceToSubject and self.lastDistanceToSubject == self:GetCameraToSubjectDistance() then
					-- Don't clobber the zoom if they zoomed the camera
					local newDistanceToSubject = diffVector.magnitude
					self:SetCameraToSubjectDistance(newDistanceToSubject)
				end
			end

			local distanceToSubject = self:GetCameraToSubjectDistance()
			local newLookVector = self:CalculateNewLookVector(cameraLook)
			self.rotateInput = ZERO_VECTOR2

			newCameraFocus = CFrame.new(subjectPosition)
			newCameraCFrame = CFrame.new(subjectPosition - (distanceToSubject * newLookVector), subjectPosition)

			self.lastDistanceToSubject = distanceToSubject
		end
	else
		-- Unsupported type, return current values unchanged
		return camera.CFrame, camera.Focus
	end

	self.lastUpdate = now
	return newCameraCFrame, newCameraFocus
end

return LegacyCamera
