A帧图像/光标未指向同一对象

时间:2017-03-01 19:26:29

标签: aframe

我正在尝试类似于this链接中的Stereo-Sky A-Frame Component的示例。演示链接无效,因此我在修复aframe-master.min.js的来源后上传了示例here

在VR中查看后(在带有卡板的三星s7边缘),我发现两只眼睛的图像都没有对齐。特别是当我尝试将指针放在路上的点上时,我发现它们的数量很少。

我很困惑我做错了什么; A-Frame的来源是错误的吗?或者左眼和右眼需要“修改”图像?设备上是否有可能影响图像渲染的设置?为了便于参考,我将源代码: -

<!DOCTYPE html>
    <html>
        <head>
            <title>A-Frame walkthrough (final)</title>
            <script src="https://rawgit.com/aframevr/aframe/3620e8e/dist/aframe-master.min.js"></script>
            <script src="stereocube.js"></script>
        </head>
    <body>
      <a-scene>
        <a-assets>
          <img id="circle" src="circle.png"/>
        </a-assets>

        <a-camera stereocam position="-47 0 -35" ><a-cursor fuse="true" color="#2E3A87" timeout="700">
            <a-animation begin="cursor-click" easing="ease-in" attribute="scale" dur="800" 
                         fill="backwards" from="1.0 1.0 1.0" to="100 100 100">
            </a-animation>
        </a-camera>

        <a-mixin id="waypt" rotation="0 0 25" scale="2 2 2"></a-mixin>
        <a-mixin id="spin" attribute="rotation" dur="10000" fill="forwards" to="0 360 25" repeat="indefinite"></a-mixin>
        <a-mixin id="enter" begin="cursor-mouseenter" easing="ease-in" attribute="scale" dur="200" to="4 4 4"></a-mixin>
        <a-mixin id="leave" begin="cursor-mouseleave" easing="ease-out" attribute="scale" dur="200" to="2 2 2"></a-mixin>

        <a-box id="wp1" color="orange"    href="brooke0" position="-40 -10 10" mixin="waypt" src="#circle"> 
            <a-animation mixin="enter"></a-animation>
            <a-animation mixin="leave"></a-animation>
            <a-animation mixin="spin"></a-animation>
        </a-box>
        <a-box id="wp2" color="green"     href="brooke1" position="  0 -14  0" mixin="waypt" src="#circle" ><a-animation mixin="spin"></a-animation><a-animation  mixin="enter"></a-animation><a-animation  mixin="leave"></a-animation></a-box>
        <a-box id="wp3" color="lightblue" href="brooke3" position=" 15  -9 35" mixin="waypt" src="#circle"> <a-animation mixin="spin"></a-animation><a-animation  mixin="enter"></a-animation><a-animation  mixin="leave"></a-animation></a-box>
        <a-box id="wp4" color="red"       href="brooke2" position="-47 -9 -35" mixin="waypt" src="#circle"> <a-animation mixin="spin"></a-animation><a-animation  mixin="enter"></a-animation><a-animation  mixin="leave"></a-animation></a-box>

        <a-entity id="skyL" position="-47 0 -35" skycube="folder:brooke2L; eye:left" scale="1 1 -1"></a-entity>
        <a-entity id="skyR" position="-47 0 -35" skycube="folder:brooke2R; eye:right" scale="1 1 -1"></a-entity>
      </a-scene>
    </body>

    <script>

    var app = {
      init:  function() {
        // Add Click handler's to our waypoints in javascript
        [].forEach.call(document.querySelectorAll('a-box'), function(box) {
            box.addEventListener('click', function () {
              window.setTimeout(function(){
                app.setSkybox ( box.getAttribute('href') );
                app.moveCamera ( box.getAttribute('position'), document.querySelectorAll('a-camera')[0] );
                app.hideWaypoints(box.id);
              },600)
            })
        });
        app.hideWaypoints("wp4");
      },

      setSkybox:  function(selectedFolder) {
        document.querySelector('#skyL').setAttribute('skycube',{folder: selectedFolder+"L", eye:"left"});
        document.querySelector('#skyR').setAttribute('skycube',{folder: selectedFolder+"R", eye:"right"});
      },

      hideWaypoints:  function(boxid) {
        document.querySelector('#wp4').setAttribute('visible',boxid === "wp1");
        document.querySelector('#wp2').setAttribute('visible',boxid != "wp4");
        document.querySelector('#wp3').setAttribute('visible',boxid != "wp4");
      },

      moveCamera:  function(newPosition, camera) {
        var pos = newPosition.x +" 0 "+ newPosition.z;
        camera.setAttribute('position', pos );
        // move the cubemap to the same position as the camera, to avoid distortion
        document.querySelector('#skyL').setAttribute('position', pos );
        document.querySelector('#skyR').setAttribute('position', pos );
      },
    }

    app.init();

    </script>

    </html>

0 个答案:

没有答案