I created a tube by a procedural mesh component. The tube consists of 40 rings with 12 ring segments. Guess I am wrong here but I assumed that I just have to add the number of vertices for each ring and segment in the order the had been added to the vertices array for createing the procedural mesh. This is the current code:
float HorizontalStep = 1.0f / RingSegments;
float VerticalStep = 1.0f / LengthSegments;
TArray<FVector2D> UVs;
for (int32 SegmentIndex = 0; SegmentIndex <= LengthSegments; ++SegmentIndex) {
for (int32 RingSegmentIndex = 0; RingSegmentIndex < RingSegments; ++RingSegmentIndex) {
// Calculate UVs
FVector2D UV;
UV.X = HorizontalStep * RingSegmentIndex;
UV.Y = VerticalStep * SegmentIndex;
UVs.Add(UV);
}
}
And this is what my UV map looks like. It seem that the last vertex of each ring segment is somehow connected to the first vertex of the previous line. What I’m doing wrong?