【问题标题】:AFRAME - disable cursor gaze on specific elementsAFRAME - 禁用特定元素上的光标注视
【发布时间】:2017-05-15 19:46:42
【问题描述】:

我正在使用以下代码进行视觉反馈:

<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<a-scene>
  <a-entity cursor="fuse: true; fuseTimeout: 500" position="0 0 -1" geometry="primitive: ring" material="color: black; shader: flat">
    <a-animation begin="click" easing="ease-in" attribute="scale" fill="backwards" from="0.1 0.1 0.1" to="1 1 1"></a-animation>
    <a-animation begin="cursor-fusing" easing="ease-in" attribute="scale" fill="forwards" from="1 1 1" to="0.1 0.1 0.1"></a-animation>
  </a-entity>
</a-scene>

问题在于,此代码应用于光标与场景中的每个原始实体“碰撞”的地方。我希望它仅适用于特定元素。 (或者,禁用特定元素的动画)。我该怎么做?

谢谢

【问题讨论】:

    标签: aframe


    【解决方案1】:

    cursor 组件依赖于raycaster 组件。如果 raycaster 组件没有作为 DOM 元素的属性添加,则光标组件将使用默认设置进行初始化。但是,当提供时,您可以更改 raycaster 组件的某些属性值以满足您的需要。

    幸运的是,raycaster 组件支持带有 DOM 查询选择器的特定实体。

    <a-entity cursor raycaster="objects: .clickable"></a-entity>
    

    这将使光标仅向类名为clickable&lt;a-entity&gt;s 发出事件。

    这里是所有 raycaster 组件属性的链接:raycaster component properties

    【讨论】:

      猜你喜欢
      • 2015-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-20
      • 2019-07-30
      • 1970-01-01
      • 1970-01-01
      • 2016-05-20
      相关资源
      最近更新 更多