Exploring the world of augmented reality for the web has been an interesting journey for me. I have been experimenting with aframe-ar.js and aframe.js to create a unique experience. One of the challenges I faced was making an image draggable within the <a-scene>
. I started by using the <a-assets>
tag to register the image and then implemented <a-image>
to display it when the marker is detected through the webcam. Despite my best efforts, I struggled to make the image draggable, trying various options along the way. Below is a snippet of the code I have been working on:
<!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>