0

I want to drop and drag object in A-Frame. I used

<script src="https://unpkg.com/aframe-click-drag-component"></script>

I also saw this problem has been answered in this post. However it is not working in my case.

here is sample code between <a-scene> tag:

    <a-entity click-drag position="-2 -1 -1">
        <a-obj-model  checked="off" visible="false" id="deer1" src="#deer11" mtl="#deer11-material" scale="0.1 0.1 0.1" rotation=" 0 -40 0">
            <a-animation attribute="scale" begin="mouseenter" to="0.2 0.2 0.2"></a-animation>
            <a-animation attribute="scale" begin="mouseleave" to="0.1 0.1 0.1"></a-animation>
            <a-animation attribute="rotation" begin="click" to=" 0 360 0" dur="1000" direction="alternate-reverse"></a-animation>
        </a-obj-model>
    </a-entity>

Between <head> tag I declared:

<script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
<script>
    // TypeScript 2.2 requires 'exports' global variable.
    var exports = {};
</script>
<script src="/js/drap_drop.js"></script> 
<script>
    window.aframeDraggableComponent(window.AFRAME)
</script> 
<script src="/js/aframe-mouse-cursor-component.min.js" type="text/javascript"></script>

After that, in the console, some error appear like image below.:

error image in console

Does anyone have idea to solve this problem. Thank in advance.

dev_Zoro
  • 1
  • 2
  • 1
    Ok, thank for your advise. It is the first time I post question on Stack Overflow. I have changed my question format. I hope to get answer from you guys soon. – dev_Zoro Oct 19 '18 at 09:54
  • Use 0.8.2 A-Frame version. 0.4.0 is an old one. The errors come from `drap_drop.js` file. They seem unrelated to A-Frame. You’ll need to share relevant code or we won’t be able to help you. – Diego Marcos Oct 19 '18 at 13:36
  • I just save code from "https://unpkg.com/aframe-click-drag-component" with name "drap_drop.js". I followed code in this post : (https://stackoverflow.com/questions/39939318/a-frame-vr-how-to-drag-and-drop-assets-elements-insight-a-picture/39949162#39949162) .Here is error after i change version of A-Frame (ReferenceError: require is not defined in aframe-click-drag-component:1 TypeError: e is undefined in component.js. ) Please tell me what should I need to do next . Thanks – dev_Zoro Oct 19 '18 at 14:40

0 Answers0