Hello everyone
i have 3 cubes , is it possible when I panning the camera the engine do not render the red and yellow cube and when the camera stop moving, the red and yellow cube start to render.
here is my PG: https://playground.babylonjs.com/#6XIT28#278
You can check if the camera is moving by checking the current position vs the previous position. If the values are the same (not moving) then you can render the cubes.
1 Like
Hi @msDestiny14
Thanks a lot for answering to. my question.
sorry for my question
,how can I check the camera current position vs camera previous position?
In the engine.runRenderLoop(() => {} function you will want get the position of the camera:
var cameraX = camera.position.x; then save it somewhere then when you get to the render loop again you check again and compare. 
again sorry for my question ,
first of all Thanks a lot for all of your help.
I use your recommend and now I can check the current position and previous position of the camera, now how can I not render the loop when the camera is moving.
I try to invisible the red cube when the camera is moving, and it is worked. but I want to not render the red cube, how can I said to the engine to not render the cube while the camera moving and when camera stoped render the red cube.
here is my PG: https://playground.babylonjs.com/#6XIT28#283
here is My code:
let preCamX = camera.position.x;
let preCamY = camera.position.y;
let preCamZ = camera.position.z;
let curCamX,curCamY,curCamZ;
console.log("1",preCamX)
engine.runRenderLoop(() => {
curCamX = camera.position.x
curCamY = camera.position.y
curCamZ = camera.position.z
if(preCamX == curCamX || preCamY == curCamY || preCamZ == curCamZ){
box2.isVisible = true
console.log(preCamX == curCamX || preCamY == curCamY || preCamZ == curCamZ)
} else{
box2.isVisible = false
}
preCamX = curCamX;
preCamY = curCamY;
preCamZ = curCamZ;
})