框纸板按钮(磁铁)单击不会触发 [英] aframe cardboard button (magnet) click does not trigger

查看:96
本文介绍了框纸板按钮(磁铁)单击不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Aframe项目中,我想用纸板磁性按钮控制移动速度=>用纸板按钮开始/停止。

In my aframe project i want to controll the movement speed with the cardboard magnetic button => start/stop with cardboard button.

在我的桌面和电话上,单击事件的工作方式与我想要的一样,但是如果将iphone放在纸板中,则不会触发单击按钮。如果我在场景上用手指触摸,它将起作用...

On my desktop and phone the click event works like i want but if i put my iphone in the cardboard the button "click" doesn't trigger. If i touch with my finger on the scene it works...

光标是否需要一些设置才能访问硬纸板按钮?我测试了谷歌纸板应用程序中的按钮,它起作用了。

Does the cursor need some settings to have access to the cardboard button? I tested the button in the google cardboard app and it worked.

这里是我所拥有的东西的一个小例子。您可以在控制台中看到click事件。

Here is a little example of what i have. You can see the click event in the console.

    <!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Click Test</title>
    <script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-extras.ocean@3.13.1/dist/aframe-extras.ocean.min.js"></script>
    <script>
    AFRAME.registerComponent("start-click", {
        init: function() {

            this.el.addEventListener("click", function() {
                console.log("clicked in the scene")
            });
        }
        });
    </script>
</head>

<body>
    <a-scene start-click>
        <!-- sky + ocean -->
        <a-sky radius="100" color="tomato" position="0 -6 0 "></a-sky>
        <a-ocean id="ocean" width="200" depth="200" density="200" position="0 0 0"></a-ocean>

        <!-- camera + cursor. -->
        <a-camera id="camera" position="0 20 80 " fly wasd-controls-enabled="false">
            <a-cursor fuse="false" id="cursor" color="black"></a-cursor>
        </a-camera>
    </a-scene>
    <script>
        document.querySelector("a-scene").enterVR();
    </script>
</body>

</html>


推荐答案

版本1纸板上的磁铁开关无法被检测到网络浏览器。版本2的屏幕触摸开关可以。

The magnet switch on version 1 cardboard cannot be detected by a web browser. The screen-touch switch on version 2 can.

这篇关于框纸板按钮(磁铁)单击不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆