How to transform position of y axis in A-Frame 0.8.0?

时间:2019-01-18 18:09:38

标签: aframe

I'm trying to animate this vase so it just rotates in place around its y axis, but it's doing that while moving in a circle, leading me to believe that I need to move the anchor's position (wish I knew how). You can see the VR scene here. Here's my code for this rotating asset:

<a-entity position=".7 1 -3">
          <a-gltf-model id="testvase1" rotation = "0 0 0" scale=".05 .05 .05"
                       src="#gltf" position="-.08 0 -.005">
          </a-gltf-model>
           <a-animation attribute="rotation" dur="10000" 
                       from= "0 0 0" to="0 360 0" repeat="indefinite"></a-animation>    
        </a-entity>

Full code available here

1 个答案:

答案 0 :(得分:0)

两个问题:

不要平移对象使其绕中心旋转。

<a-entity position="0 0 0">
  <a-gltf-model id="testvase1" rotation = "0 0 0" scale="2 2 2" src="#gltf" position="0 0 0"></a-gltf-model>
  <a-animation attribute="rotation" dur="10000" from= "0 0 0" to="0 360 0" repeat="indefinite"></a-animation>    
</a-entity>

您的模型不在坐标原点的中心。您将需要导入3d包(例如Blender)并重新导出为中心。这是一个示例,其中包含您的代码和一个居中的模型:https://glitch.com/edit/#!/utopian-walleye?path=public/index.html:32:19

相关问题