为什么我的程序不断收到 "raycaster" 的警告?当我什至不使用它时

Why my program keeps getting warning for "raycaster"? When I am not even using it

为什么我的代码在动画期间旋转半圈后自行停止,并且我收到与 'raycaster' 相关的警告。知道如何解决吗? 谁能指出我可能犯的错误?

您可能正在使用 cursor. a-frame cursors use raycasting to check for intersections. The console warns you, that it would be more performant to provide a list of objects you want to be interactable

您可以通过提供选择器(例如 class)将对象列入白名单:

raycaster="objects: .interactable"

例如,在这里您只能与 class 包括 interactable:

的对象进行交互

<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<a-scene cursor="rayOrigin: mouse;" raycaster="objects: .interactable">
  <a-box position="-1 0.5 -3" rotation="0 45 0" class="interactable"
    animation__on="property: scale; to: 1.2 1.2 1.2; dur: 200; easing: linear; 
    startEvents: mouseenter"
    animation__out="property: scale; to:  1 1 1; dur: 200; easing: linear;
    startEvents: mouseleave"
   color="#4CC3D9"></a-box>
   
  <a-box position="1 0.5 -3" rotation="0 45 0"
    animation__on="property: scale; to: 1.2 1.2 1.2; dur: 200; easing: linear; 
    startEvents: mouseenter"
    animation__out="property: scale; to:  1 1 1; dur: 200; easing: linear;
    startEvents: mouseleave"
   color="#AAFFaa"></a-box>
</a-scene>