Cocos creator 如何画一条3D空间的线

  • Creator 版本: 3.2

  • 目标平台: 真机

如何用Creator画一条3D的曲线,比如炮弹的轨迹。

炮弹的轨迹不是用拖尾吗

贝塞尔曲线?

真的没办法画一条线吗???x1 y1 z1 to x2 y2 z2 的一条线都不支持吗?

1赞

还真是,之前没有想过。用过graphics在2d平面画线
creator2.4.6,还真不知道,最多这样了


我猜是想做弹道预测吧。

这两天尝试做的:


主要是用:utils.createMesh

                var IGeometry1 = {
                        positions: vertices,//positions,// 顶点位置
                        indices: indices,//几何索引,当使用索引绘制时。
                        //uvs: uvs,//纹理坐标
                        primitiveMode: primitiveMode,//几何顶点的拓扑图元。默认值是TRIANGLE_LIST。
                        attributes: attributes // 顶点属性 specify vertex attributes, use (positions|normals|uvs|colors) as keys}
                creatmesh = utils.createMesh(IGeometry1);
                creatmesh.onLoaded();
     go1_mesh.mesh = creatmesh;

做轨迹感觉直接用物理拖尾吧,回头试试画曲线~

先做一个3D线条预制件模型,然后在想画线的时候放置这个预制件,设置好长度位置方向就行了,我就喜欢用些土方法~

线段组件 · Cocos Creator 文档有