Is it possible to just make change on the mesh when the camera is panning but not in zoom in/out?

Hello everyone

here is my code for get the previous and current location of the camera and then If the camera panning not render the side cubes:

   let preCamX = camera.position.x;
    // let preCamY = camera.position.y;
    // let preCamZ = camera.position.z;
    let curCamX,curCamY,curCamZ;

engine.runRenderLoop(() => {
      curCamX = camera.position.x
    //   curCamY = camera.position.y
    //   curCamZ = camera.position.z
      if(preCamX == curCamX ){
        box2.setEnabled(true)
        box3.setEnabled(true)

      } else{
        box2.setEnabled(false)
        box3.setEnabled(false)

      }
    
      preCamX = curCamX;
    //   preCamY = curCamY;
    //   preCamZ = curCamZ;
})

but the problem is I want to render the side cubes in zoom in/out?
what can I do to solve this problem?

I wonder if you could enable a flag for when the mouse wheel is active (assuming this is your zoom key). This feels like a hacky solution though :confused:

1 Like

Thanks a lot for your answer, but the mouse wheel is always active. is it any way to found the moving of mouse wheel?

https://playground.babylonjs.com/#6XIT28#288

I have solved it. Thanks a lot. :pray:t2:

2 Likes