javascriptthree.jstransformationraycasting

threejs disable orbit camera while using transform control


I have a scene with multiple meshes, each one of them associated to a different transformControl; in order to select different objects, I'm using raycasting techniques. I'm also using an orbit camera in order to navigate the scene.

Whenever I modify the position/rotation/scale of the selected object using transform control, I want to disable orbit camera, because sometimes while I'm clicking on a picker, I'm also picking on the background of the scene, so the orbit camera moves.

I'd like to stop this behavior and I've already tried to handle it with raycasting techniques, but it doesn't work.


Solution

  • Stumbled over this and thought it would be helpful to see the answer (credits to BuildingJarl):

    // if youre definition is like
    var controls = new THREE.OrbitControls( camera );
    
    // you can easily disable it by using
    controls.enabled = false;
    

    In my case I was using a UI overlay and I got issues with getting the focus to it. Disabling the controls solved my problems.

    Greetings Mat