function LegacyCamera.SetCameraToSubjectDistance(V,a)return BaseCamera.SetCameraToSubjectDistance(V,a)end function LegacyCamera.Update(V,a)if not V.cameraType then return end local D=tick()local W=D-V.lastUpdate local Q=workspace.CurrentCamera local F=Q.CFrame local O=Q.Focus local Z=PlayersService.LocalPlayer if V.lastUpdate==nil or W>1 then V.lastDistanceToSubject=nil end local B=V:GetSubjectPosition()if V.cameraType==Enum.CameraType.Fixed then if V.lastUpdate then local a=math.min(.1,D-V.lastUpdate)local W=V:UpdateGamepad()V.rotateInput=V.rotateInput+W*a end if B and(Z and Q)then local a=V:GetCameraToSubjectDistance()local D=V:CalculateNewLookVector()V.rotateInput=ZERO_VECTOR2 O=Q.Focus F=CFrame.new(Q.CFrame.p,Q.CFrame.p+a*D)end elseif V.cameraType==Enum.CameraType.Attach then if B and Q then local a=V:GetCameraToSubjectDistance()local W=V:GetHumanoid()if V.lastUpdate and(W and W.RootPart)then local a=math.min(.1,D-V.lastUpdate)local Q=V:UpdateGamepad()V.rotateInput=V.rotateInput+Q*a local F=W.RootPart.CFrame.lookVector local O=Util.GetAngleBetweenXZVectors(F,V:GetCameraLookVector())if Util.IsFinite(O)then V.rotateInput=Vector2.new(O,V.rotateInput.Y)end end local Q=V:CalculateNewLookVector()V.rotateInput=ZERO_VECTOR2 O=CFrame.new(B)F=CFrame.new(B-a*Q,B)end elseif V.cameraType==Enum.CameraType.Watch then if B and(Z and Q)then local a=nil local D=V:GetHumanoid()if D and D.RootPart then local D=B-Q.CFrame.p a=D.unit if V.lastDistanceToSubject and V.lastDistanceToSubject==V:GetCameraToSubjectDistance()then local a=D.magnitude V:SetCameraToSubjectDistance(a)end end local W=V:GetCameraToSubjectDistance()local Z=V:CalculateNewLookVector(a)V.rotateInput=ZERO_VECTOR2 O=CFrame.new(B)F=CFrame.new(B-W*Z,B)V.lastDistanceToSubject=W end else return Q.CFrame,Q.Focus end V.lastUpdate=D return F,O 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

	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
