【问题标题】:Can you interact with a web AR scene with A-Frame?您可以使用 A-Frame 与 Web AR 场景进行交互吗?
【发布时间】:2019-07-02 15:58:16
【问题描述】:

您能否与 A-Frame 中的移动(魔术窗口)网络 AR 场景进行交互,就像您可以在下面链接的 8th Wall 演示中那样。

举个例子:在 Web AR 平面上放置三个按钮,您是否有用户按下其中一个按钮的事件?

第 8 墙演示:https://8thwall.com/web

【问题讨论】:

    标签: augmented-reality aframe 8thwall-xr webxr


    【解决方案1】:

    您可以通过将rayOrigin 设置为mouse 的a 帧光标来创建可交互实体。例如:

    <a-marker preset='hiro'>
       <a-box interactable></a-box>
    </a-marker>
    <a-camera-static cursor="rayOrigin: mouse" />
    

    查看this glitch


    假设 interactable 是一个自定义组件:
    AFRAME.registerComponent('interactable', {
       init: function() {
          this.el.addEventListener('click', e => {
             // magic
          })
       }
    })
    

    【讨论】:

      猜你喜欢
      • 2021-04-04
      • 1970-01-01
      • 2021-02-17
      • 2022-01-10
      • 1970-01-01
      • 1970-01-01
      • 2015-11-12
      • 2017-12-29
      • 1970-01-01
      相关资源
      最近更新 更多