Tengo un modelo 3D que estoy tratando de presentar en una página web. En realidad, este modelo es como una habitación. Quiero cambiar la posición de la cámara a diferentes puntos dentro de la habitación para poder ver mi habitación desde diferentes ángulos. Para este propósito, estoy usando. Cámara de perspectiva y controles de órbita Estoy tratando de cambiar este método de oribtcontrols
entrada del carro(escala del carro) salida del carro(escala del carro)
aquí está mi código
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; } }de modo que cuando desplace la rueda del mouse en lugar de hacer zoom, mi cámara debería moverse hacia la dirección en la que mira
cualquier ayuda será apreciada