如何在框架曲线组件中更改曲线类型
How to change curve type in a-frame curve-component
我正在使用 a-frame curve component 为事物创建移动路径。不过,我似乎无法更改曲线 type
。
文档表明有 4 种可用类型 ('CatmullRom', 'Spline', 'CubicBezier', 'QuadraticBezier', 'Line'
),但我无法更改默认值 'CatmullRom'
。
请看下面我所做的尝试,这些尝试表明尝试影响类型没有区别。在一个中,我将类型作为 a-curve
的属性传递,在另一个中,我将类型作为 curve
组件的 属性 传递(因为这似乎启用了 closed
属性,最后一个我根本没有改变它。(我使用 a-draw-curve
来说明渲染曲线。
<!-- create the path with type defined as property of curve -->
<a-curve id="track1" curve="closed:true;type:CubicBezier">
<a-curve-point position="-3 0.5 -3"></a-curve-point>
<a-curve-point position="-2 2 -3"></a-curve-point>
<a-curve-point position="-1 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track1" material="shader: line; color: blue;"></a-draw-curve>
<!-- create the path with type defined as attribute of a-curve -->
<a-curve id="track2" curve="closed:true" type="CubicBezier">
<a-curve-point position="-1 0.5 -3"></a-curve-point>
<a-curve-point position="0 2 -3"></a-curve-point>
<a-curve-point position="1 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track2" material="shader: line; color: blue;"></a-draw-curve>
<!-- create the path with no type defined, result is the same -->
<a-curve id="track3" curve="closed:true">
<a-curve-point position="1 0.5 -3"></a-curve-point>
<a-curve-point position="2 2 -3"></a-curve-point>
<a-curve-point position="3 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track3" material="shader: line; color: blue;"></a-draw-curve>
结果如下,如您所见,它们看起来都一样。
在每种情况下,如果我查看附加到 a-curve
的组件,我可以看到它正在回落到 CatmullRom
我是不是做错了什么?
感谢任何建议
恐怕其他类型没有实现。在distribution (line 126), you can see a commented placeholder. I'd suggest filing an issue.
此外,'adding' 个组件的更多曲线可能并不像看起来那么微不足道,因为只有 spline 和 CatmullRom 曲线可以从 Vector3
个点的数组创建,其余的他们需要一组固定的三个(start - mid - end)或四个(中间两个)点.
我正在使用 a-frame curve component 为事物创建移动路径。不过,我似乎无法更改曲线 type
。
文档表明有 4 种可用类型 ('CatmullRom', 'Spline', 'CubicBezier', 'QuadraticBezier', 'Line'
),但我无法更改默认值 'CatmullRom'
。
请看下面我所做的尝试,这些尝试表明尝试影响类型没有区别。在一个中,我将类型作为 a-curve
的属性传递,在另一个中,我将类型作为 curve
组件的 属性 传递(因为这似乎启用了 closed
属性,最后一个我根本没有改变它。(我使用 a-draw-curve
来说明渲染曲线。
<!-- create the path with type defined as property of curve -->
<a-curve id="track1" curve="closed:true;type:CubicBezier">
<a-curve-point position="-3 0.5 -3"></a-curve-point>
<a-curve-point position="-2 2 -3"></a-curve-point>
<a-curve-point position="-1 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track1" material="shader: line; color: blue;"></a-draw-curve>
<!-- create the path with type defined as attribute of a-curve -->
<a-curve id="track2" curve="closed:true" type="CubicBezier">
<a-curve-point position="-1 0.5 -3"></a-curve-point>
<a-curve-point position="0 2 -3"></a-curve-point>
<a-curve-point position="1 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track2" material="shader: line; color: blue;"></a-draw-curve>
<!-- create the path with no type defined, result is the same -->
<a-curve id="track3" curve="closed:true">
<a-curve-point position="1 0.5 -3"></a-curve-point>
<a-curve-point position="2 2 -3"></a-curve-point>
<a-curve-point position="3 0.5 -3"></a-curve-point>
</a-curve>
<!-- Draw the Curve to visualise -->
<a-draw-curve curveref="#track3" material="shader: line; color: blue;"></a-draw-curve>
结果如下,如您所见,它们看起来都一样。
在每种情况下,如果我查看附加到 a-curve
的组件,我可以看到它正在回落到 CatmullRom
我是不是做错了什么?
感谢任何建议
恐怕其他类型没有实现。在distribution (line 126), you can see a commented placeholder. I'd suggest filing an issue.
此外,'adding' 个组件的更多曲线可能并不像看起来那么微不足道,因为只有 spline 和 CatmullRom 曲线可以从
Vector3
个点的数组创建,其余的他们需要一组固定的三个(start - mid - end)或四个(中间两个)点.