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