Rotating the volume programtically does not work in NRRD example

Thanks @manthrax for your reply. I did try the various methods you suggested and for this particular volume renderer non of them worked. The only thing that worked for me was to switch to orbitcontrol and try this code:

              controls.enabled = false;      //disable orbitControls
              controls.reset();         //reset orbitControls
              const vect3 = new THREE.Vector3(); //define any vector (here we just point at 0,0,0)
              controls.target = vect3;      //update orbitControls target
              switch(axis) {
                case 'x':
                  camera.position.set(300,0,0);
                  break;
                case 'y':
                  // code block
                  camera.position.set(0,350,0);
                  break;
                case 'z':
                  camera.position.set(0,0,250); 
                  break;  
                default:
                  // code block
              }
              camera.lookAt(vect3);       //optional pre-rotation (in case orbit is not updated in render loop)
              controls.enabled = true;      //enable orbitControl again

Thanks to this article: Rotate camera and adapt OrbitControls - #2 by Oxyn

The rotation now works in all three axises.

1 Like