A-frame mouse-tracking changes when scene is embedded

痴心易碎 提交于 2020-02-07 23:05:06

问题


I am creating a desktop/mobile/VR game using A-frame, involving finding a number of hidden items in an image.

The image is used as the source for an entity, creating a 360-dgree image. In the desktop version, the user can use the mouse to pan around the image, and then click on the hidden items to reveal them. The reveal is done by positioning an entity, with an image as it's texture, in front of the hidden item, and then animating the to become visible when clicked on.

The game works perfectly in when the is NOT embedded. However, I need to embed the scene in order to make it part of a larger website, and when I embed it the mouse tracking becomes unreliable. That is, in the non-embedded version I can click directly on, say Item A, and it will be revealed as expected. However, once embedded, I have to click somewhere near, but not on, Item A in order for the reveal to occur.

It seems as though embedding the scene does something to alter the local coordinates, or alter how they translate to the 2D mouse position in the window, but I have been unable to find any sort of documentation regarding this issue.

Can anyone help?


回答1:


Okay, it turns out the issue was because I was using an older version of the aframe-mouse-cursor-component, which did not account for embedded scenes. The component has recently been updated and everything now works properly!



来源:https://stackoverflow.com/questions/44442056/a-frame-mouse-tracking-changes-when-scene-is-embedded

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!