简体   繁体   English

aframe-光标组件-单击事件在最后一个相交处触发,而不是第一个

[英]aframe - cursor component - click event fires on last occured intersection instead of the first one

assume we have an <a-scene> with a cursor component and manually configure the raycaster component later and set the .interactable objects. 假设我们有一个带有光标组件的<a-scene> ,然后稍后手动配置raycaster组件并设置.interactable对象。

Let's say we have two or more of these objects behind each other and let the raycaster fire through them. 假设我们有两个或两个以上的这些物体彼此靠在一起,然后让光线投射器通过它们发射。 What we want is to fire the click event on the first element respectively the element in the foreground. 我们想要的是在第一个元素或前景中的元素上触发click事件。 But what we noticed is that aframe fires the click event on the last intersected object respectively the one in the background (it's the last entry of raycaster.intersections ). 但是我们注意到的是,框架会在最后一个相交的对象上分别触发click事件,而在背景上是该事件(这是raycaster.intersections的最后一个条目)。

Does someone know how we could avoid this? 有人知道我们如何避免这种情况吗? I hope this question isn't a duplicate, I did not found a similiar one. 我希望这个问题不是重复的,我没有找到类似的问题。 Else feel free to remove this question. 否则,请随时删除此问题。 Thank you for your help 谢谢您的帮助

For anyone who noticed the same problem: 对于注意到相同问题的任何人:

It's the A-Frame version. 这是A-Frame版本。 We still used version 0.8.0. 我们仍然使用0.8.0版本。 But they improved the behaviour of the raycaster component in 0.8.2 / 0.9 for reference: https://github.com/aframevr/aframe/issues/3485 and https://github.com/aframevr/aframe/pull/3475 但他们在0.8.2 / 0.9中改进了raycaster组件的行为以供参考: https : //github.com/aframevr/aframe/issues/3485https://github.com/aframevr/aframe/pull/3475

Thanks to the A-Frame Team! 感谢A-Frame团队!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM