Android上的Chrome:触摸事件不适用于实体点击

时间:2020-01-14 19:26:39

标签: google-chrome aframe touch-event ontouch

问题是:在VR模式下通过触摸点击移动设备上的点击事件 无法从Android Chrome 79+开始运行。 无法从VR模式在实体上触发其他单词touchstart事件。 Google Vr服务已安装并启用。

目标a-entity应该在Chrome最新的79+版本中可以点击 用户点击(VR模式下,点击移动设备上的点击)

链接到整个代码: 这里2配置简单的应用程序: https://4dkly.csb.app/(配置:保险丝3.6秒;但是从chrome vr上单击实体不起作用) https://codesandbox.io/s/aframe-example-4dkly?fontsize=14&hidenavigation=1&theme=white

https://12k87.csb.app/(光标颜色为红色;保险丝已关闭,光标仍然不起作用)
https://codesandbox.io/s/aframe-example-12k87?fontsize=14&hidenavigation=1&theme=dark 您能否看一下本示例中的任何一个,并告诉该怎么做,以使chrome最新,vr模式下触摸点击。 任何新的好方法新的api也可以。

此处代码摘录

 <script src="https://aframe.io/releases/1.0.1/aframe.min.js"></script>

    <a-scene main> 
      <a-sphere position="0 2 -5" radius="1.25" color="#EF2D5E"> </a-sphere>
 <!-- ... -->

      <a-camera id="camera" camera rotation>
        <a-entity
          id="cursor"
          cursor="fuse:false"
          position="0 0 -1"
          material="color: #111;"

        >
        </a-entity>
      </a-camera>
//simple event on click 
 document.querySelector("a-box").addEventListener("click", () => {
   alert("box");
});```  

1 个答案:

答案 0 :(得分:1)

您描述的行为是预期的。通过WebXR进入沉浸式模式时,浏览器会禁用触摸事件,例如Chrome 79+以及通过https投放内容的情况都是如此。在工作中有新的API可以在AR中呈现时实现交互性。您可以在此博客文章中找到更多详细信息:https://aframe.io/blog/webxr-ar-module/

在没有本机WebXR实现的设备上,VR模式依赖于全屏API,并且可以使用touchevents。

我不建议在VR中依赖屏幕输入并使用fuse based cursor