如何在A型框架中为牛顿摇篮建模弦乐及其运动

时间:2018-09-21 18:18:50

标签: html physics aframe

我正在尝试在A型框架中代表牛顿的摇篮。我并不是要对实际的物理模型建模,只是要获得看起来很接近的东西。我的问题是创建一种表示代表球的线的东西,并使其以与球类似的方式进行动画(跟随它)。

我尝试过使用圆柱体(右侧),但发现很难通过旋转将圆柱体的顶部固定在适当的位置。

我尝试使用社区库中的网格线,发现很难修改path属性的第二个顶点以跟球一起运动。

对于尝试使用哪种类型的对象以及如何使其达到预期效果的动画,是否有任何建议?如果您检查GH,我也将使用aframe-curve-component来指导球的位置,并且希望以某种方式使用它。

摘要...

        <!-- line for ball -->
        <a-entity meshline="lineWidth: 2; path: -4 1 -10, -4 8.5 -10; color: #999"
                rotation="0 0 0">       
        </a-entity>

        <!-- string for ball -->
        <a-cylinder height="8" radius="0.015" color="white" position="4 5 -10">
            <!--<a-animation property="position" to="7 2.25 -10" dur="1000" delay="4000"></a-animation>
            <a-animation property="rotation" to="0 0 30" dur="1000" delay="4000"></a-animation>-->
        </a-cylinder>

1 个答案:

答案 0 :(得分:0)

您需要旋转圆柱体,以将动画原点移动到圆柱体的顶部而不是中间。

使用下一版A-Frame附带的动画组件(https://github.com/ngokevin/kframe/tree/master/components/animation)。

类似...

<a-entity animation="property: rotation; from: 0; to: 45; dir: alternate; loop: true">
  <a-entity class="pivot" position="0 -<HALF OF CYLINDER HEIGHT> 0">
    <a-cylinder ...></a-cylinder>
  </a-entity>
</a-entity>