a-frame vr如何拖放资产/元素洞察图片? [英] a-frame vr how to drag and drop assets / elements insight a picture?

查看:82
本文介绍了a-frame vr如何拖放资产/元素洞察图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试A框架,却找不到有关如何拖放元素的任何信息,并且已经寻找了好几个小时!有人熟悉框架吗?
谢谢

I am trying out a-frame and can't find anything about how to drag and drop elements and have been looking for it for hours! Is anyone familiar with a-frame? Thanks

那是我到目前为止的代码:

thats my code so far:

<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:

browser/home.html:

  <scene scene-id="sceneId"></scene>

浏览器/js/app/directives/screne.html:

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

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内置的,但是您可以使用第三方组件来获得预期的结果。

This isn't built into Aframe, but you can use a 3rd party component to get the desired results.

aframe-click-drag-component 允许在屏幕上单击和拖动实体:

aframe-click-drag-component allows for clicking and dragging entities around on the screen:


具有 click-drag 组件的实体可以在3D周围单击并拖动现场。

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>


查看演示

这篇关于a-frame vr如何拖放资产/元素洞察图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆