function BaseCamera.OnKeyUp(L,r,P)if r.KeyCode==Enum.KeyCode.Left then L.turningLeft=false elseif r.KeyCode==Enum.KeyCode.Right then L.turningRight=false end end function BaseCamera.UpdateMouseBehavior(r)if r.inFirstPerson or r.inMouseLockedMode then UserGameSettings.RotationType=Enum.RotationType.CameraRelative UserInputService.MouseBehavior=Enum.MouseBehavior.LockCenter else UserGameSettings.RotationType=Enum.RotationType.MovementRelative if r.isRightMouseDown or r.isMiddleMouseDown then UserInputService.MouseBehavior=Enum.MouseBehavior.LockCurrentPosition else UserInputService.MouseBehavior=Enum.MouseBehavior.Default end end end function BaseCamera.UpdateForDistancePropertyChange(r)r:SetCameraToSubjectDistance(r.currentSubjectDistance)end function BaseCamera.SetCameraToSubjectDistance(P,r)local L=Players.LocalPlayer local M=P.currentSubjectDistance if L.CameraMode==Enum.CameraMode.LockFirstPerson then P.currentSubjectDistance=.5 if not P.inFirstPerson then P:EnterFirstPerson()end else local M=Util.Clamp(L.CameraMinZoomDistance,L.CameraMaxZoomDistance,r)if M<FIRST_PERSON_DISTANCE_THRESHOLD then P.currentSubjectDistance=.5 if not P.inFirstPerson then P:EnterFirstPerson()end else P.currentSubjectDistance=M if P.inFirstPerson then P:LeaveFirstPerson()end end end ZoomController.SetZoomParameters(P.currentSubjectDistance,math.sign(r-M))return P.currentSubjectDistance end function BaseCamera.SetCameraType(P,r)P.cameraType=r end function BaseCamera.GetCameraType(r)return r.cameraType end
--Remove with FFlagPlayerScriptsBindAtPriority
function BaseCamera:OnKeyUp(input, processed)
	if input.KeyCode == Enum.KeyCode.Left then
		self.turningLeft = false
	elseif input.KeyCode == Enum.KeyCode.Right then
		self.turningRight = false
	end
end

function BaseCamera:UpdateMouseBehavior()
	-- first time transition to first person mode or mouse-locked third person
	if self.inFirstPerson or self.inMouseLockedMode then
		UserGameSettings.RotationType = Enum.RotationType.CameraRelative
		UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
	else
		UserGameSettings.RotationType = Enum.RotationType.MovementRelative
		if self.isRightMouseDown or self.isMiddleMouseDown then
			UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
		else
			UserInputService.MouseBehavior = Enum.MouseBehavior.Default
		end
	end
end

function BaseCamera:UpdateForDistancePropertyChange()
	-- Calling this setter with the current value will force checking that it is still
	-- in range after a change to the min/max distance limits
	self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end

function BaseCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
	local player = Players.LocalPlayer

	local lastSubjectDistance = self.currentSubjectDistance

	-- By default, camera modules will respect LockFirstPerson and override the currentSubjectDistance with 0
	-- regardless of what Player.CameraMinZoomDistance is set to, so that first person can be made
	-- available by the developer without needing to allow players to mousewheel dolly into first person.
	-- Some modules will override this function to remove or change first-person capability.
	if player.CameraMode == Enum.CameraMode.LockFirstPerson then
		self.currentSubjectDistance = 0.5
		if not self.inFirstPerson then
			self:EnterFirstPerson()
		end
	else
		local newSubjectDistance =
			Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredSubjectDistance)
		if newSubjectDistance < FIRST_PERSON_DISTANCE_THRESHOLD then
			self.currentSubjectDistance = 0.5
			if not self.inFirstPerson then
				self:EnterFirstPerson()
			end
		else
			self.currentSubjectDistance = newSubjectDistance
			if self.inFirstPerson then
				self:LeaveFirstPerson()
			end
		end
	end

	-- Pass target distance and zoom direction to the zoom controller
	ZoomController.SetZoomParameters(
		self.currentSubjectDistance,
		math.sign(desiredSubjectDistance - lastSubjectDistance)
	)

	-- Returned only for convenience to the caller to know the outcome
	return self.currentSubjectDistance
end

function BaseCamera:SetCameraType(cameraType)
	--Used by derived classes
	self.cameraType = cameraType
end

function BaseCamera:GetCameraType()
	return self.cameraType
end
