2017-03-16 35 views
1

this question有些相关,我似乎无法找到一种“框内”方式来更改A-Frame对象(例如,地球的倾斜轴)的旋转轴。如何更改动画A-Frame对象的旋转轴?

链接的问题,指的是通过包装在一个父实体对象,这将抵消子实体改变旋转枢轴点(见下图):

<a-entity rotation="0 45 0">  <!-- Parent entity --> 
    <a-box position="0 1 0"></a-box> <!-- Child entity --> 
</a-entity> 

我已经采取了类似的方法,但不是抵消枢轴点,我试图改变旋转轴。当添加动画到父,旋转总是沿着全局Y轴,而非本地(父母的)旋转Y轴:

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

有谁知道如何最好地轴从全球 - 改变到本地空间,或者如果有一种方法来围绕倾斜的轴进行动画制作?

+1

我想你可以添加一个额外的父实体,并旋转。打开A帧检查器(ctrl + alt + i)并播放旋转看看你想旋转的方式。 – ngokevin

+0

@ngokevin太简单了!有效。你能否重新发表你的评论作为我接受的答案? – CodeMacabre

+0

甜,添加了一个答案。 – ngokevin

回答

2

我想你可以添加一个额外的父实体,并旋转。

<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> 

打开A字架督察(Ctrl + Alt + i)和与旋转,看你要旋转哪种方式打球。