function LegacyCamera.SetCameraToSubjectDistance(T,a)return BaseCamera.SetCameraToSubjectDistance(T,a)end function LegacyCamera.Update(T,a)if not T.cameraType then return end local X=tick()local F=X-T.lastUpdate local J=workspace.CurrentCamera local r=J.CFrame local N=J.Focus local g=PlayersService.LocalPlayer local s=T:GetHumanoid()local e=J and J.CameraSubject local k=e and e:IsA("\086\101\104\105\099\108\101\083\101\097\116")local u=e and e:IsA("\083\107\097\116\101\098\111\097\114\100\080\108\097\116\102\111\114\109")local I=s and s:GetState()==Enum.HumanoidStateType.Climbing if T.lastUpdate==nil or F>1 then T.lastDistanceToSubject=nil end local y=T:GetSubjectPosition()if T.cameraType==Enum.CameraType.Fixed then if T.lastUpdate then local a=math.min(.1,X-T.lastUpdate)local F=T:UpdateGamepad()T.rotateInput=T.rotateInput+F*a end if y and(g and J)then local a=T:GetCameraToSubjectDistance()local X=T:CalculateNewLookVector()T.rotateInput=ZERO_VECTOR2 N=J.Focus r=CFrame.new(J.CFrame.p,J.CFrame.p+a*X)end elseif T.cameraType==Enum.CameraType.Attach then if y and J then local a=T:GetCameraToSubjectDistance()local F=T:GetHumanoid()if T.lastUpdate and(F and F.RootPart)then local a=math.min(.1,X-T.lastUpdate)local J=T:UpdateGamepad()T.rotateInput=T.rotateInput+J*a local r=F.RootPart.CFrame.lookVector local N=Util.GetAngleBetweenXZVectors(r,T:GetCameraLookVector())if Util.IsFinite(N)then T.rotateInput=Vector2.new(N,T.rotateInput.Y)end end local J=T:CalculateNewLookVector()T.rotateInput=ZERO_VECTOR2 N=CFrame.new(y)r=CFrame.new(y-a*J,y)end elseif T.cameraType==Enum.CameraType.Watch then if y and(g and J)then local a=nil local X=T:GetHumanoid()if X and X.RootPart then local X=y-J.CFrame.p a=X.unit if T.lastDistanceToSubject and T.lastDistanceToSubject==T:GetCameraToSubjectDistance()then local a=X.magnitude T:SetCameraToSubjectDistance(a)end end local F=T:GetCameraToSubjectDistance()local g=T:CalculateNewLookVector(a)T.rotateInput=ZERO_VECTOR2 N=CFrame.new(y)r=CFrame.new(y-F*g,y)T.lastDistanceToSubject=F end else return J.CFrame,J.Focus end T.lastUpdate=X return r,N 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
	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
