How to detect when the camera starts moving and when it stops

I simply need a way to detect when the Camera starts moving ( mostly looking for when the Player rotates the camera, but just any movement would already be great. ) and how to detect when it stops, any ideas on how to get this?

1 Like

Yes! This would be quite easy tbh, all you need to do is put a rendered stepped event in a localscript and a variable that holds the camera’s CFrame, and every time the rendered stepped function i called (every frame on the client the script is on) check to see if the camera’s CFrame == the CFrame you saved to the variable, if it isnt then the camera has been moved/rotated and set the varaible to the new CFrame, then run ur code but use a debounce because if the camera is constantly moving, it would run many times therefore potentially causing ur client to lag, but it all depends on the code tbh

You could try something like this. (within a local script)

It will detect rotation and position updates
(if you only want to detect position then use cam.CFrame.Position instead)

local cam = game.Workspace.CurrentCamera
local oldPos = CFrame.new(0,0,0)
local stopped=false

-- each frame the camera will either move, stop, or do nothing.
game:GetService("RunService").RenderStepped:Connect(function()
    if(cam.CFrame ~= oldPos) then
        print("MOVED")
        oldPos = camera.CFrame
        stopped=false
    else
        if(stopped==false) then
            stopped=true
            print("STOPPED")
        end
    end
end)
4 Likes