A框架:rayOrigin光标和鼠标同时 [英] A-Frame: rayOrigin cursor and mouse at same time
问题描述
我已经实现了以下示例中的事件: https://aframe-event-set-component.glitch.me/
I've implemented events like in this example: https://aframe-event-set-component.glitch.me/
这些事件现在可以监听我的光标或鼠标.如何在一个应用程序中结合使用这两种方法,以便可以通过鼠标和光标触发事件?就像这里一样:
https://github.com/mayognaise/aframe-mouse-cursor-component (不再受最新的A-Frame支持)
These events now ether listen to my cursor OR to my mouse.
How can i combine both methods in one application so that the events can be triggered by mouse and cursor? Just like here:
https://github.com/mayognaise/aframe-mouse-cursor-component (not supported by the latest A-Frame any more)
我可以写类似 cursor ="rayOrigin:mouse&& cursor"
这样的东西吗?
Can i write something like cursor="rayOrigin: mouse && cursor"
?
最诚挚的问候!
推荐答案
对于 click
事件:它似乎与两个 cursor
组件一起工作: a-scene
,然后在相机中放置一个:
As for the click
event: it seems to be working with two cursor
components: one in the a-scene
, and one in the camera:
<a-scene cursor="rayOrigin: mouse">
<a-camera position="0 1.6 0">
<a-entity cursor="fuse: true; fuseTimeout: 500" position="0 0 -1" geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03" material="color: black; shader: flat">
</a-entity>
</a-camera>
</a-scene>
在此小提琴中进行检查.
另一方面,
a-scene
光标似乎弄乱了其他事件.您可以提交问题,或创建一个组件来删除鼠标 cursor
,当发出 enter-vr
事件时.
Check it in this fiddle.
On the other hand the
a-scene
s cursor seems to mess up the other events.
You could file an issue, or create a component, which removes the mouse cursor
when the enter-vr
event is emitted.
...
this.el.sceneEl.addEventListener("enter-vr", function() {
this.el.removeAttribute("cursor")
})
this.el.sceneEl.addEventListener("exit-vr", function() {
this.el.setAttrubute("cursor", "rayOrigin", "mouse")
})
这篇关于A框架:rayOrigin光标和鼠标同时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!