drop and drag object in A-Frame

放肆的年华 提交于 2021-02-20 05:20:07

问题


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.

来源:https://stackoverflow.com/questions/52888886/drop-and-drag-object-in-a-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!