标签: webvr

无法使用krpano项目进入VR模式

描述

您好,我正在关注krpano oculus rift教程.关于krpano的一切都在工作,除了我无法让它在VR模式下运行.

我试过的

要使用Oculus Rift在VR模式下运行html,我需要:

  1. 下载并安装一个实验性网页浏览器.我选择了FirefoxNightly(它可以与krpanos在线演示一起使用).
  2. 添加"输入VR"按钮并添加onclick以运行 enterVR

我也检查过,每晚在我的Firefox上安装并激活webvr插件.

错误

在我的控制台中,当我单击我的按钮时,我收到此错误.

ReferenceError:未定义enterVR

问题

我做错了什么,错过了什么?

本教程的这一部分我不太明白.

立体渲染支持(输出端):使用WebVR插件并调用enterVR()动作时,立体渲染将自动启用...

WeBVR插件是一个可点击的元素,链接到此页面.他们开始讨论webvr.jsxml页面的可能属性.

<plugin name="WebVR" devices="html5" keep="true"
        url="webvr.js"
        worldscale="1.0"
        mousespeed="0.00125"
        mobilevr_support="true"
        mobilevr_ipd="63.5"
        mobilevr_screensize="auto"
        mobilevr_lens_fov="96"
        mobilevr_lens_dist="0.6"
        mobilevr_lens_vign="100"
        mobilevr_webvr_dist="false"
        mobilevr_sensor_mode="3"
        mobilevr_fake_support="false"
        vr_cursor=""
        vr_cursor_onover=""
        vr_cursor_onout=""
        onavailable=""
        onunavailable=""
        onunknowndevice=""
        onentervr=""
        onexitvr=""
        />
Run Code Online (Sandbox Code Playgroud)

webvr插件(firefoxnightly附带的插件)是否包含以上所有内容?如果不是我如何找到这个webvr.js,如何将其包含在我的项目(或firefoxnightly)与xml文件?

这些可能是非常简单的问题,但我花了很多时间试图找出它并没有成功.我感谢任何帮助.谢谢.

javascript xml oculus krpano webvr

1
推荐指数
1
解决办法
3823
查看次数

Google VRView for Web - 添加热点

项目:基本网站,使用Google的VRView for Web显示全景图像并添加热点.

问题:全景显示正常,无法添加热点,文档很差+谷歌搜索导致几乎没有结果.1.5小时.

码:

<script type="text/javascript">

window.addEventListener('load', onVrViewLoad)
function onVrViewLoad() {
  var vrView = new VRView.Player('#vrview', {
    image: 'uploads/pano.jpg',
    is_stereo: false
  });

  vrView.addHotspot('hotspot-one', {
         pitch: 30, // In degrees. Up is positive.
          yaw: 20, // In degrees. To the right is positive.
          radius:   0.05, // Radius of the circular target in meters.
          distance: 2, // Distance of target from camera in meters.
    });
}

</script>

<div id="vrview">
</div>
Run Code Online (Sandbox Code Playgroud)

请求:有没有人能够实施这些热点?我也尝试添加点击按钮,无济于事.试图在laravel服务器和基本的html实现中,无济于事.

支持文档/示例:

javascript webvr google-vr google-vr-sdk

1
推荐指数
1
解决办法
1771
查看次数

获取相机位置javascript

我想在我的Aframe应用程序中获取相机的位置,但它始终为0,尽管我移动相机.

我尝试了事件监听器和定期检索位置,但没有获得更新的值.

这是场景:

<a-scene>
  <a-entity id="cameraWrapper" position="0 2 10" rotation="0 0 0">
    <a-camera near="0.1" user-height="0" id="camera"></a-camera>
  </a-entity>
  <a-plane position="0 4 4" rotation="-90 0 -90" width="4" height="4" color="#7BC8A4"></a-plane>
  <a-sky color="#ECECEC"></a-sky>
</a-scene>
Run Code Online (Sandbox Code Playgroud)

这是用于监控摄像机位置的javascript代码:

  <script>
    window.onload = function () {
      var pos = 
    document.querySelector('#camera').getAttribute('position');
    document.querySelector('[camera]').addEventListener('componentchanged', function (evt) {
        console.log('CAMERA x/y:', pos.x, pos.y);
        if (evt.name === 'position') { 
          console.log('Entity has moved from POSITION', evt.oldData, 'to', evt.newData, '!');
          return; 
        }
          return; 
      });
    };
  </script>
Run Code Online (Sandbox Code Playgroud)

但是条件if(evt.name ==='position')永远不会成立,并且相机位置保持为0,即使使用键盘输入在相机位置移动时也是如此.如何连续拍摄相机位置?

javascript webvr aframe

1
推荐指数
1
解决办法
1781
查看次数

WEBVR和Threejs,如何检查用户是否处于VR模式?

Threejs 网站和其他地方的所有示例和教程都提供了这一行:

document.body.appendChild( WEBVR.createButton( renderer ) );
Run Code Online (Sandbox Code Playgroud)

其中添加了一个漂亮的小按钮来进入 VR 模式。但似乎没有任何方法可以检测用户是否按下了它并进入了 VR 模式。而且除了使用那个按钮之外似乎没有任何方法可以进入VR模式。我错过了什么吗?

three.js virtual-reality webvr

0
推荐指数
1
解决办法
1422
查看次数

A型暂停/播放动画混合器

我想知道如何使用 Aframe extras 组件的动画混合器属性来暂停/播放动画。目前,我的场景中有一个带动画的鸟的 gltf 模型。我想做的是,当单击暂停按钮时,发出一个函数并且动画将暂停,当触发播放函数时,动画将从停止的地方继续。如何才能做到这一点?当前代码:

    <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
<script>

function pause() {
//pause the animation
}

function play() {

//play the animation
}</script>
<button onclick="pause()" style="z-index: 10000000; position: fixed; margin-top: 0px; cursor: pointer;">
Pause
</button>
<button onclick="play()" style="z-index: 10000000; position: fixed; margin-top: 0px; cursor: pointer; margin-left: 50px;">
play
</button>
<a-scene>
  <a-entity gltf-model="https://cdn.glitch.global/815f53ca-b7db-40aa-8843-e718abdfbf6d/scene%20-%202022-01-16T183239.246.glb?v=1642386788500" position="20 0 -35" rotation="0 90 0" scale="0.1 0.1 0.1" animation-mixer="clip:Take 001; loop:10000000000000000000; timeScale: 1; crossFadeDuration: 1"></a-entity>
</a-scene>
Run Code Online (Sandbox Code Playgroud)

我读到了donmccurdy在 github 上发布的一个可能的解决方案,但我不确定如何以有效的方式将其放入我的代码中。帖子链接:https://github.com/n5ro/aframe-extras/issues/222

链接到拨弄代码: …

three.js webvr aframe

0
推荐指数
1
解决办法
2602
查看次数