Javascript 将鼠标事件绑定到a帧对象
我正在为一个增强现实项目使用aframe和AR.js。我正在尝试将鼠标事件附加到3D对象上。根据ar.js文档,您必须使用光标 我试图做的是,将鼠标作为光标,然后使用Javascript 将鼠标事件绑定到a帧对象,javascript,dom-events,aframe,Javascript,Dom Events,Aframe,我正在为一个增强现实项目使用aframe和AR.js。我正在尝试将鼠标事件附加到3D对象上。根据ar.js文档,您必须使用光标 我试图做的是,将鼠标作为光标,然后使用aframe鼠标光标组件将鼠标事件附加到鼠标上,如图所示 它在一定程度上起作用。我可以使用鼠标在屏幕上拖动3D资源,但没有任何鼠标事件起作用 这是HTML: <!DOCTYPE html> <html> <head> <title></title> </hea
aframe鼠标光标组件将鼠标事件附加到鼠标上,如图所示
它在一定程度上起作用。我可以使用鼠标在屏幕上拖动3D资源,但没有任何鼠标事件起作用
这是HTML:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
<script src="js/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/aframe-mouse-cursor-component@0.5.3/dist/aframe-mouse-cursor-component.min.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs='sourceType: webcam' cursor="rayOrigin: mouse">
<a-assets>
<!--Used <a-asset-item> here -->
</a-assets>
<a-marker type='pattern' url='markers/mainmarker.patt'>
<a-entity right gltf-model="#arrow" scale="1.5 1.5 1.5" ></a-entity>
<!-- other <a-entity> entities -->
</a-marker>
<a-entity camera look-controls mouse-cursor>
<!-- <a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.049; radiusOuter: 0.05"
material="color: red; shader: flat">
</a-entity> I have tried the code with and without this part -->
</a-entity>
</a-scene>
</body>
</html>
我已经尝试了很多活动-鼠标下移、鼠标点击、点击等等,但都不起作用
如何将这些事件绑定到鼠标?框架在光标组件中具有鼠标模式
<a-entity cursor="rayOrigin: mouse">
我也试过这个,它确实使鼠标在3D对象附近看起来有所不同,但鼠标向下仍然不起作用
<a-entity cursor="rayOrigin: mouse">