如何更改动画 A-Frame 对象的旋转轴?
How to change the rotation axis for an animated A-Frame object?
与 this question 有点相关,我似乎找不到 'in-framework' 方法来更改 A 型框架对象的旋转轴(例如地球的倾斜轴)。
链接的问题是指通过将对象包装在父实体中来更改旋转轴心点,这将偏移子实体(见下文):
<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">
有谁知道如何最好地将轴从全局更改为局部space,或者是否有围绕倾斜轴设置动画的方法?
我认为您可以在所有内容周围添加一个额外的父实体并旋转它。
<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-Frame Inspector (ctrl + alt + i) 并尝试旋转以查看您想要旋转的方向。
与 this question 有点相关,我似乎找不到 'in-framework' 方法来更改 A 型框架对象的旋转轴(例如地球的倾斜轴)。
链接的问题是指通过将对象包装在父实体中来更改旋转轴心点,这将偏移子实体(见下文):
<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">
有谁知道如何最好地将轴从全局更改为局部space,或者是否有围绕倾斜轴设置动画的方法?
我认为您可以在所有内容周围添加一个额外的父实体并旋转它。
<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-Frame Inspector (ctrl + alt + i) 并尝试旋转以查看您想要旋转的方向。