【发布时间】:2020-09-08 15:29:06
【问题描述】:
我有一个 raycaster-intersection 事件侦听器连接到我的右侧激光控制器,如下所示:
<a-entity id="rightController" laser-controls="hand: right" raycaster="objects: .collidable; far: 20"></a-entity>
...
rightController.addEventListener("raycaster-intersection", function(e) {
console.log(e);
});
可碰撞对象示例:
<a-sphere class="collidable" color="yellow" radius="5" position="31.617 7.159 -10.258" scale="0.1 0.1 0.1"></a-sphere>
当光线投射器与 .collidable 对象相交时,事件已成功发出,但我无法从事件变量 (e) 中找到有关相交对象的任何信息。我真的不想将事件附加到这些对象中的每一个,因为我需要 20 个事件侦听器。
就像事件输出不完整...Aframe 文档暗示“els”数组应该包含我要查找的内容,但它是空的。也没有 .getIntersection() 函数。有什么想法吗?
【问题讨论】:
标签: three.js aframe raycasting