How to change the rotation axis for an animated A-Frame object?

后端 未结 1 531
臣服心动
臣服心动 2021-01-24 06:35

Somewhat related to this question, I can\'t seem to find an \'in-framework\' way to change the rotational axis for an A-Frame object (like Earth\'s tilted axis, for example).

相关标签:
1条回答
  • 2021-01-24 07:12

    I think you can add an additional parent entity around everything and rotate that.

    <a-entity>  <!-- Grandparent entity -->
      <a-animation
        attribute="rotation"
        easing="linear"
        dur="60000"
        to="0 360 0"
        repeat="indefinite">
      </a-animation>           
      <a-entity rotation="0 0 25">        <!-- Parent entity --> 
        <a-box position="0 0 0></a-box>  <!-- Child entity -->
      </a-entity>
    </a-entity>
    

    Open the A-Frame Inspector (ctrl + alt + i) and play with the rotation to see which way you want to rotate.

    0 讨论(0)
提交回复
热议问题