2

我正在尝试使用 aframe-ar.js 和 aframe.js 的网络增强现实。我想让我放置的图像可拖动<a-scene>。我使用<a-assets>标签首先注册图像,然后<a-image>在网络摄像头中识别标记时用于显示图像。图像已成功显示,但即​​使尝试了许多选项,我也无法使其可拖动。我的代码在这里:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Augmented Reality For Web</title>
    <script src="three.js"></script>
    <script src="aframe.min.js"></script>
    <script src="aframe-ar.js"></script>
    <script src="aframe-click-drag-component.min.js"></script>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
    <script src="https://unpkg.com/aframe-click-drag-component"></script>
    </head>
    <body>
    <a-scene embedded arjs='sourceType: webcam;'>
    <a-assets>
    <img id="my-image" src="Samplee.jpg"><img>
    </a-assets>
    <a-image id="img_disp"  src="#my-image" rotation="90 180 0" 
    visible="true">
    </a-image>  
    <a-marker-camera preset='hiro'></a-marker-camera>
    </a-scene>
    </body>
    </html>
4

1 回答 1

0

这不是 A-Frame 内置的,但您可以使用 3rd 方组件来获得所需的结果。

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

查看演示

于 2017-11-22T21:14:59.177 回答