0

我想在 3d Unity 中绘制线条网格。我发现我可以在 Unity 4 中使用 MeshTopology.Lines 画线。

但我找不到如何使用 MeshTopology.Lines 的示例。如何在 Unity 3d 中绘制线条?

4

1 回答 1

0
Vector3[] verts = new Vector3[]{Vector3.up, Vector3.right, Vector3.down, Vector3.left};
int[] indicesForLineStrip = new int[]{0,1,2,3,0};
//int[] indicesForLines = new int[]{0,1,1,2,2,3,3,0};
Mesh mesh = new Mesh();
mesh.vertices = verts;
mesh.SetIndicies(indicesForLineStrip, MeshTopology.LineStrip, 0);
//mesh.SetIndicies(indicesForLines, MeshTopology.Lines, 0);
mesh.RecalculateNormals();
mesh.RecalculateBounds();
于 2013-01-24T13:28:04.393 回答