无法在三个js中旋转或平移我的全景

gir*_*ish 7 javascript three.js

我没有使用默认代码在三个js中进行相机旋转

lat = Math.max( - 85, Math.min( 85, lat ) );
phi = THREE.Math.degToRad( 90 - lat );
theta = THREE.Math.degToRad( lon );
camera.target.x = 100 * Math.sin( phi ) * Math.cos( theta );
camera.target.y = 100 * Math.cos( phi );
camera.target.z = 100 * Math.sin( phi ) * Math.sin( theta );
Run Code Online (Sandbox Code Playgroud)

相反,我正在做lookVector.applyAxisAngle(axis, 0.001);,因此我认为我无法使用鼠标平移360度图像.我把我的代码放在小提琴https://jsfiddle.net/sh60yqfx/32/ 请帮助..谢谢

Rah*_*lvi 2

进行了以下更改并且似乎有效。请在本地尝试。

function onPointerUp( event ) {
    isUserInteracting = false;
}

 function onPointerMove( event ) {
    if ( isUserInteracting === true ) {
        var clientX = event.clientX || event.touches[ 0 ].clientX;
        var clientY = event.clientY || event.touches[ 0 ].clientY;
        lon = ( onMouseDownMouseX - clientX ) * 0.1 + onMouseDownLon;
        lat = ( clientY - onMouseDownMouseY ) * 0.1 + onMouseDownLat;
    }
}
Run Code Online (Sandbox Code Playgroud)

当用户停止移动鼠标(或触摸结束)时需要停止隔行扫描

function render() {            
        lookVector.set(lon,lat,11);
        lookVector.applyAxisAngle(axis, 0.001);         
        camera.lookAt(lookVector);
        renderer.render(scene, camera);            
}
Run Code Online (Sandbox Code Playgroud)

在函数中根据& &render()设置值,然后将设为。lookVectorlonlatcameralookAtlookVector