Detecting Camera Rotation

I want to make an Isometric System where your camera rotates around the character conically, like isometric but you can change the angle you view them from. This has been accomplished, but the problem is, I can't figure out how to detect when the camera is trying to move.

This code has it where if you are holding right click (shift lock doesn't work), the camera does move with mouse movements (although very sensitive and may be reversed). However, if you stop moving your mouse (and keep holding right click) it just uses the velocity from the previous frame.

I want this to work for all forms of moving the camera normally, including console and mobile, is there an easier way to do this or a fix to what I have?

local UserInputService = game:GetService("UserInputService")
local zoom = 140
local FieldOfView = 9
local minZoom = 10
local maxZoom = 200

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Custom

local RunService = game:GetService("RunService")

local rotationSpeed = 0.01 -- Mouse rotation sensitivity
local angle = 0
local fixedAngle = math.rad(45)
local rotationInput = 0
local rotating = false -- Flag for when the player is rotating the camera
local lastMouseX = 0 -- To track last mouse X position

-- Mouse wheel zoom functionality
Mouse.WheelForward:Connect(function()
zoom = math.max(minZoom, zoom - 10)
end)

Mouse.WheelBackward:Connect(function()
zoom = math.min(maxZoom, zoom + 10)
end)

-- Toggle rotation control based on right-click and ShiftLock
local function updateRotationInput(input)
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter or UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
rotating = true
rotationInput = -input.Delta.X * rotationSpeed
else
rotating = false
rotationInput = 0
end
end

-- Start or stop rotating the camera based on input
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
rotating = true
end
end)

UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
rotating = false
rotationInput = 0
end
end)

-- Adjust rotation input based on mouse movement
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
if rotating then
updateRotationInput(input)
lastMouseX = input.Position.X
else
rotationInput = 0
end
end
end)

-- Update camera position on every frame
RunService.RenderStepped:Connect(function(deltaTime)
Camera.FieldOfView = FieldOfView
if Character then
if Character:FindFirstChild("Head") then
game:GetService("SoundService"):SetListener(Enum.ListenerType.ObjectCFrame, Character.Head)

-- Apply rotation input to the angle
angle = angle + rotationInput

-- Calculate camera offset based on the angle and zoom
local xOffset = math.cos(angle) * zoom
local yOffset = math.sin(fixedAngle) * zoom
local zOffset = math.sin(angle) * zoom

-- Update camera position based on the character's head and calculated offsets
Camera.CFrame = CFrame.new(Vector3.new(Character.Head.Position.X + xOffset, Character.Head.Position.Y + yOffset, Character.Head.Position.Z + zOffset), Character.Head.Position)
end
end
end)