我想在3d Unity中绘制线条网格。 我发现我可以使用Unity 4中的MeshTopology.Lines绘制线条。
但我无法找到示例如何使用MeshTopology.Lines。 如何在Unity 3d中绘制线条?
答案 0 :(得分: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();