On camera stop moving (Camera Event)

Hello guys i was searching for any event i can subscribe to check if the camera has stopped moving (after each mouse drag or using mouse wheel)
as an example i need to make some manipulation to my ui position but it depend on camera position,alpha,beta and radius so i was asking for if there any event i can listen to so it can be triggered on camera stopped moving so i can do my stuff
or even if there’s work around for this .

thanks in advance

I don’t think we have such an event. It should be relatively easy to implement using scene.onAfterCameraRenderObservable or something similar and check if the camera has moved since the last event.


thanks for your replay
But how can do this kind of heavy task on method the executes each frame !
in my case i just want to do this task only once camera stopped moving

Check if the camera has changed each frame, but only do your task if the camera stops changing.

1 Like

You save the “beta, alpha and radius” of your camera in a variable. Then each time your camera moves, the values ​​change, so your camera to move. Record the new values ​​of your camera in the variable and compare with that of your camera current.

For example a piece of code like this (you just have a condition to do in the onAfterCameraRenderObservable loop)

let moveCamera = {beta: 1, alpha: 1, radius: 5};

if(camera.radius != moveCamera.radius && ....)
//Then your camera to move