Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Is there a way I can move my camera to look around inside the 3D model using three js?

I have a 3D model which I am trying to present on a web page actually this model is like a room I want to change camera position to different points inside the room so that I can view my room from different angles for this purpose I am using Perspective camera and orbit controls I am trying to change this method from oribtcontrols

dollyIn(dollyScale) dollyOut(dollyScale)

here is my code

function dollyIn(dollyScale) {
        if (scope.object.isPerspectiveCamera) {
          var deg = Math.abs(spherical.theta); //(spherical.theta * 180)/Math.PI;
          scope.enableRotate = false;
          var th = spherical.theta;
          var step = dollyScale;
          if (0 <= th && th <= Math.PI) {
            if (0 <= th && th < Math.PI / 2) {
              console.log("Positive angle  First Quad\t" + th);
              scope.target.x += step; //(dollyScale * deg);
              scope.target.z += step; //(dollyScale * deg);
            } else if (Math.PI / 2 <= th && th <= Math.PI) {
              console.log("Positive angle Second Quad \t" + th);
              scope.target.x -= step; //(dollyScale * deg);
              scope.target.z += step; //(dollyScale * deg);
            }
          } else if (0 > th && th > -Math.PI) {
            if (0 > th && th > -Math.PI / 2) {
              console.log("Negitive angle  Fouth Quad\t" + th);
              scope.target.x += step; //(dollyScale * deg);
              scope.target.z -= step; //(dollyScale * deg);
            } else if (-Math.PI / 2 > th && th > -Math.PI) {
              console.log("Negitive angle Third Quad \t" + th);
              scope.target.x -= step; //(dollyScale * deg);
              scope.target.z -= step; //(dollyScale * deg);
            }
          }
          console.log("resetting the angle to " + th);
          spherical.theta = th;
        } else if (scope.object.isOrthographicCamera) {
          scope.object.zoom = Math.max(
            scope.minZoom,
            Math.min(scope.maxZoom, scope.object.zoom / dollyScale)
          );
          scope.object.updateProjectionMatrix();
          zoomChanged = true;
        } else {
          console.warn(
            "WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."
          );
          scope.enableZoom = false;
        }
      }

so that when I scroll the mouse wheel instead of zoom My camera should move towards the direction it is facing

any help will be appreciated

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda