Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda