如何使用 OrbitControls 进行无限制旋转

Tin*_*Zea 2 three.js

现在我使用轨道控制,只能上下方向旋转180度。在另一个方向上我可以永远旋转,我认为它是z方向。无论如何,我怎样才能让它在所有旋转方向上完全不受限制?

现在这是我的代码,我尝试了无限和不无限:

this.scene_threeD = new THREE.Scene();
this.camera_threeD = new THREE.PerspectiveCamera( 75, width_threeD / height_threeD, 0.1, 1000 );
this.renderer_threeD = new THREE.WebGLRenderer({ canvas: threeDCanvas,
                               preserveDrawingBuffer: true,
                               antialias: true });
this.renderer_threeD.setSize( width_threeD, height_threeD);
controls = new THREE.OrbitControls(this.camera_threeD, this.renderer_threeD.domElement);
        controls.maxPolarAngle = Infinity;
        controls.minPolarAngle = -Infinity;
        controls.maxAzimuthAngle = Infinity;
        controls.minAzimuthAngle=-Infinity;
        controls.update();
Run Code Online (Sandbox Code Playgroud)

Pau*_*Jan 6

“轨道相机”的问题在于(根据定义)它总是试图保持相机“向上”指向上方。这意味着当您向上或向下看时,相机方向是不确定的。这就是为什么 Three.js 实现了 makeSafe() 方法,将极角保持在 +/- 90 度角之内。

如果要消除此限制,您可能会看到相机在经过 90 度角(或更糟)时立即翻转方向。这通常是应用程序中不希望出现的行为。

总而言之:如果你想要无限旋转,你就不需要轨道相机。这不是技术上的限制,而是概念上的限制。