javascript - Google VRView for Web - 添加热点

标签 javascript google-vr webvr google-vr-sdk

项目:基础网站,用Google的VRView for Web显示全景图,添加热点。

问题:Panorama 显示正常,无法添加热点,文档很差 + 谷歌搜索导致大约 8 天的结果很少。 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>

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

支持文档/示例:

最佳答案

你必须把你的代码添加到on ready中

<script type="text/javascript">

window.addEventListener('load', onVrViewLoad)
function onVrViewLoad() {
  var vrView = new VRView.Player('#vrview', {
    image: 'uploads/pano.jpg',
    is_stereo: false
  });
vrView.on('ready',function(){
  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>

关于javascript - Google VRView for Web - 添加热点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42016909/

相关文章:

unity-game-engine - 我应该使用 "Daydream technical preview"版本的 Unity 来开发 Cardboard 吗?

react-native - React Native 360​​/全景查看器

java - Android 谷歌 VrVideoView 带 RTSP 源码

javascript - 如何在 AFrame 中移动单个顶点?

javascript - 如何重置 A 形光标的不透明度动画

javascript - 如何将所需模块的服务注入(inject)模块配置函数?

javascript - 检查 html Canvas 上特定区域的点位置

javascript - 获取带有 chrome 扩展名的打开邮件的 gmail 邮件正文

javascript - 检查更改事件内的值 IE 7-8 与其他

javascript - 使用 aframe-react 的 A-Frame 编码风格制作脚本