【发布时间】:2021-12-30 01:03:46
【问题描述】:
【问题讨论】:
标签: aframe
【问题讨论】:
标签: aframe
您可能正在使用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>
【讨论】: