如何使A-Frame光标仅与最近的对象交互

时间:2018-07-08 09:51:21

标签: cursor aframe interaction

我正在编写一个A-Frame项目。我有一些游标问题。

是否可以为属性为'cursor'的a-entity标签设置'near'?

然后光标在我的目标对象后面发出该对象的事件,这是什么原因以及如何解决它?

这是我的光标代码:

    <a-entity id="cursor"
              cursor="fuse: false"
              position="0.000 0.000 -0.1"
              geometry="primitive: ring; radiusInner: 0.0008; radiusOuter: 0.0013"
              material="color: black; shader: flat"
              near="5"
              showLine="true"
              cursor-submit
    >
    </a-entity>

项目:https://github.com/LeMueller/skills-lab-web

实时演示:http://webvr.virtualskillslab.de/

感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:0)

如果要(并且应该)将要相交的对象列入白名单,请设置raycaster.objects属性。

<a-entity cursor raycaster="objects: [data-raycastable]"

<a-sphere data-i-am-not-raycastable></a-sphere>
<a-box data-raycastable></a-box>