2017-07-07 54 views
1

我想在A-frame的事件集組件插件上使用事件集組件插件創建一個collada對象上的旋轉動畫,我已經成功地使用-box,但想要動畫化collada對象。出於某種原因,我無法看到collada對象,也不知道我要出錯的地方。請參閱下面的代碼獲取更多信息,任何幫助將不勝感激,謝謝。在A-Frame中使用collada對象的事件集組件(webvr)

<html> 
<head> 
<title>Model Test</title> 
<script src="build.js"></script> 
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> 
<script src="aframe-animation-component.min.js"></script> 
<script src="component/event-proxy.js"></script> 
<script src="https://unpkg.com/[email protected]/dist/aframe-event-set-component.min.js"></script> 
<script src="https://unpkg.com/[email protected]/dist/aframe-layout-component.min.js"></script> 
</head> 
<body> 
<a-scene> 
    <a-entity id="container" position="0 0 -2"> 
    <a-collada-model src="iPhone4.dae" 
     animation__rotationX="property: rotation; dur: 10000; 
         easing: easeInSine; loop: true; to: 0 360 0; 
         startEvents: rotY; pauseEvents: animationPause; 
         resumeEvents: animationResume; restartEvents: animationRestart" 
     animation__rotationY="property: rotation; dur: 10000; 
         easing: easeInSine; loop: true; to: 360 0 0; 
         startEvents: rotX; pauseEvents: animationPause; 
         resumeEvents: animationResume; restartEvents: animationRestart" 

     position="0 1 -2"> 
    </a-collada-model> 
    <a-mixin id="option" 
      geometry="primitive: sphere; radius: .25;" 
      material="color: red" 
      event-proxy="listen: click; target: a-collada-model" 
      ></a-mixin> 
    <a-entity position="-2.5 0 0"> 
     <a-entity mixin="option" event-proxy="emit: rotY" text="value: Rotation"></a-entity> 
    </a-entity> 
    <a-entity position="2.5 0 0"> 
     <a-entity mixin="option" event-proxy="emit: rotX" text="value: Rotation"></a-entity> 
    </a-entity> 

    <a-entity position="0 -1.5 0"> 
     <a-sphere mixin="option" event-proxy="emit: animationPause" text="value: Pause"></a-entity> 
    </a-entity> 
    </a-entity> 


    <!-- Sky. --> 
    <a-sky color="#0fbbff"></a-sky> 

    <a-entity position="0 0 3"> 
    <a-camera><a-cursor color="#FFF"></a-cursor></a-camera> 
    </a-entity> 
</a-scene> 

</body> 
</html> 

回答

0

首先升級到0.6.0。我不知道事件和動畫組件如何,但afaik模型處理在0.6.0更好。
然後嘗試使用COLLADA裝載機作爲一個組成部分,而不是原始的,像docs

<a-entity collada-model="src:iphone4.dae"></a-entity> 

如果您不能出現在模型中,您可能需要格式轉換到threejs json或.glTF,將您的iphone上傳到clara.io,或使用khronos/kupoman出口商,然後使用Don McCurdy的loaders


順便說一句你似乎沒有事件的問題,但與模型,所以主題是有點關閉:p