【问题标题】:How to make A-Frame cursor interact only with the closest object如何使 A-Frame 光标仅与最近的对象交互
【发布时间】:2018-07-08 09:51:21
【问题描述】:

我正在编写一个 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/

感谢您提供的任何帮助。

【问题讨论】:

标签: cursor aframe interaction


【解决方案1】:

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

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

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-22
  • 1970-01-01
  • 1970-01-01
  • 2012-02-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多