Bend a generated mesh on axis


I have a question is it possible with script to bend a generated mesh on selected axis.

Like here in this picture. I made road and tunnel and I want to bend a tunnel.

My vertices script:

int row = 10;
vertices = new Vector3[(numSegments + 1) * row];
System.Random rand = new System.Random();
var rndStart = rand.Next(0, roadMesh.roadPoints.Count);
for (int j = 0; j < row; j++)
    float z = roadMesh.roadPoints[rndStart].z + (j * .5f); //Start position and space between rows
    float startX = roadMesh.roadPoints[rndStart].x;
    float startY = roadMesh.roadPoints[rndStart].y;

    for (int i = 0; i <= numSegments; i++)
        float angle = Mathf.PI * i / numSegments;
        float x = Mathf.Cos(angle) * radius;
        float y = Mathf.Sin(angle) * radius;

        vertices[j * (numSegments + 1) + i] = new Vector3(x + startX, y + startY, z);

        yield return new WaitForSeconds(0.01f);

I was thinking that if I add .5f to x axis it will do the work, silly me.

SO maybe someone has an idea maybe where to start?

Thank you.

Have you looked into splines package?

This, in partiicular:

source: Extrude a mesh along a spline | Splines | 2.5.2