cursor - A-Frame:rayOrigin光标和鼠标同时
问题描述
我已经实现了这个例子中的事件: https ://aframe-event-set-component.glitch.me/
这些事件现在听我的光标或我的鼠标。如何在一个应用程序中结合这两种方法,以便可以通过鼠标和光标触发事件?就像这里:
https ://github.com/mayognaise/aframe-mouse-cursor-component (最新的A-Frame不再支持)
我可以写类似的东西cursor="rayOrigin: mouse && cursor"
吗?
此致!
解决方案
至于click
事件:它似乎与两个cursor
组件一起工作:一个在 中a-scene
,一个在相机中:
<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
s 光标似乎搞乱了其他事件。您可以提出问题,或创建一个组件,该组件会在发出事件cursor
时移除鼠标。enter-vr
...
this.el.sceneEl.addEventListener("enter-vr", function() {
this.el.removeAttribute("cursor")
})
this.el.sceneEl.addEventListener("exit-vr", function() {
this.el.setAttrubute("cursor", "rayOrigin", "mouse")
})
推荐阅读
- javascript - 深度= 1的js原生array.flat慢吗?
- wpf - WPF:ICommand,在文本框中打开一个txt文件
- amazon-web-services - 如何修复 CloudFormation 错误“提供的负载均衡器可能无效。请确保它们存在并重试
- r - R plotly:无法更改颜色渐变
- php - php 正在向 file_get_contents 添加反斜杠
- sql - 基于 SQL Server 中键/值对表中的值的重复条目
- vb.net - 为什么VB对话框工具箱中的大多数项目都会被禁用
- javascript - 部分标签是否有类似 onload 的东西?
- c# - 如何在 VRTK 4 Beta (Unity) 中添加来自 VR 控制器的按钮输入?
- json - powershell json转换问题仅在保存到变量时才正确结果