【问题标题】:Why my program keeps getting warning for "raycaster"? When I am not even using it为什么我的程序不断收到“raycaster”的警告?当我什至不使用它时
【发布时间】:2021-12-30 01:03:46
【问题描述】:

为什么我的代码在动画过程中半旋转后自行停止,并且我得到了与“raycaster”相关的警告。知道如何解决吗? 谁能提出我可能犯的错误?

【问题讨论】:

    标签: aframe


    【解决方案1】:

    您可能正在使用cursor。 a-frame 光标使用光线投射来检查交叉点。控制台会警告您,provide a list of objects you want to be interactable 的性能会更高。

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

    raycaster="objects: .interactable"
    

    例如在这里你只能与类包括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>

    【讨论】:

      猜你喜欢
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      • 2022-06-19
      • 1970-01-01
      • 2011-11-15
      • 1970-01-01
      • 1970-01-01
      • 2017-02-24
      相关资源
      最近更新 更多