I am creating a procedural mesh based on a curve and the size of the mesh gets smaller throughout the curve as you see below.
And the problem is UV gets zig-zagged as the size changes (it works perfectly when the size of the mesh is same throughout the curve).
Vertices.Add(R);
Vertices.Add(L);
UVs.Add(new Vector2(0f, (float)id / count));
UVs.Add(new Vector2(1f, (float)id / count));
start = Vertices.Count - 4;
Triangles.Add(start + 0);
Triangles.Add(start + 2);
Triangles.Add(start + 1);
Triangles.Add(start + 1);
Triangles.Add(start + 2);
Triangles.Add(start + 3);
mesh.vertices = Vertices.ToArray();
//mesh.normals = normales;
mesh.uv = UVs.ToArray();
mesh.triangles = Triangles.ToArray();
How can I fix this?
No comments:
Post a Comment