a-frame vr 如何拖放资产/元素洞察图片?
a-frame vr how to drag and drop assets / elements insight a picture?
我正在尝试 a-frame,但找不到任何关于如何拖放元素的信息,我已经找了好几个小时了!有人熟悉a-frame吗?
谢谢
到目前为止我的代码是这样的:
<a-scene>
<a-cursor></a-cursor>
<a-assets>
<img id="enemy-sprite" crossorigin="" src="mustache1.jpg">
</a-assets>
<a-image look-at="#player" src="#enemy-sprite" transparent="true" position="0 1.8 -4"></a-image>
<a-camera id="player" position="0 1.8 0"></a-camera>
<a-sky src="street.jpg"></a-sky>
编辑:
browser/home.html:
<scene scene-id="sceneId"></scene>
browser/js/app/directives/screne.html:
<a-scene>
<a-sphere click-drag position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-camera look-controls-enabled="false"></a-camera>
</a-scene>
index.html
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-click-drag-component"></script>
<script> registerAframeClickDragComponent(window.AFRAME); </script>
这不是 Aframe 内置的,但您可以使用第 3 方组件来获得所需的结果。
aframe-click-drag-component
允许在屏幕上点击和拖动实体:
Entities with the click-drag
component can be click and dragged around the 3D scene. Even works while the camera is moving or rotating!
<head>
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-click-drag-component"></script>
<script>
registerAframeClickDragComponent(window.AFRAME);
</script>
</head>
<body>
<a-scene>
<a-sphere click-drag position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-camera look-controls-enabled="false"></a-camera>
</a-scene>
</body>
查看 the demo。
我正在尝试 a-frame,但找不到任何关于如何拖放元素的信息,我已经找了好几个小时了!有人熟悉a-frame吗? 谢谢
到目前为止我的代码是这样的:
<a-scene>
<a-cursor></a-cursor>
<a-assets>
<img id="enemy-sprite" crossorigin="" src="mustache1.jpg">
</a-assets>
<a-image look-at="#player" src="#enemy-sprite" transparent="true" position="0 1.8 -4"></a-image>
<a-camera id="player" position="0 1.8 0"></a-camera>
<a-sky src="street.jpg"></a-sky>
编辑: browser/home.html:
<scene scene-id="sceneId"></scene>
browser/js/app/directives/screne.html:
<a-scene>
<a-sphere click-drag position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-camera look-controls-enabled="false"></a-camera>
</a-scene>
index.html
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-click-drag-component"></script>
<script> registerAframeClickDragComponent(window.AFRAME); </script>
这不是 Aframe 内置的,但您可以使用第 3 方组件来获得所需的结果。
aframe-click-drag-component
允许在屏幕上点击和拖动实体:
Entities with the
click-drag
component can be click and dragged around the 3D scene. Even works while the camera is moving or rotating!<head> <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script> <script src="https://unpkg.com/aframe-click-drag-component"></script> <script> registerAframeClickDragComponent(window.AFRAME); </script> </head> <body> <a-scene> <a-sphere click-drag position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere> <a-camera look-controls-enabled="false"></a-camera> </a-scene> </body>
查看 the demo。