【问题标题】:Three.VRControls initial rotation三.VR控制初始旋转
【发布时间】:2016-10-15 07:36:09
【问题描述】:

我已经完成了这个Unable to change camera position when using VRControlsThree.js - VRControls integration - How to move in the scene?,但它并没有完全满足我的需要。

我有一个 VR 视频应用程序,我刚刚从旧的和自定义的东西切换到带有 WebVR polyfill 的 VRControls。这工作得很好,但是我真的很难设置初始相机角度。

即我希望相机开始指向一个特定的角度,然后用控件旋转 - 但是控件总是覆盖这个角度。

我尝试将摄像头添加到多莉组或透视摄像头,我似乎可以移动摄像头但无法设置初始视角。

这是相机的设置方式

    container = document.getElementById('container');

    camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1024);

    scene = new THREE.Scene();

    target = new THREE.Vector3();

    renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    container.appendChild(renderer.domElement);

    var vrEffect = new THREE.VREffect(renderer);
        vrEffect.setSize(window.innerWidth, window.innerHeight);

    var params = {
        hideButton: false, // Default: false.
        isUndistorted: false // Default: false.
    };
    manager = new WebVRManager(renderer, vrEffect, params);
    dolly = new THREE.PerspectiveCamera();
    dolly.add( camera );
    //scene.add( dolly );
    controls = new THREE.VRControls(camera);// (I've tried using Dolly here)
    controls.standing = true;

我尝试了各种方法来旋转相机、小车或场景

    camera.position.y = currentScene.pan * Math.PI/180;
    //controls.resetPose();
    //dolly.position.x = currentScene.tilt * Math.PI/180;
    //camera.updateProjectionMatrix();

我可以旋转网格,但是网格内的所有对象都在错误的位置.. 我可以尝试移动它们,但这似乎是错误的方法将相机指向我想要的位置..

【问题讨论】:

  • 您是否尝试过旋转小车组? dolly.rotation.x = 50*Math.PI/180;

标签: three.js virtual-reality


【解决方案1】:

稍后将相机重新添加到场景中,覆盖小车。它现在正在工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多