I have made my bezier/curver road tool, wich make curved lines with some nodes. Now what i want to do and i really dont have idea how to do it is to generate mesh along that curved line i created. Any suggestions how could i generate that mesh wich is following road curve?
So this is how it looks now. Curved line is LineRenderer, but i want to generate real mesh instead of that LineRenderer.
In short, you sample along the ‘path’ every few steps, at each step you record the offsets of the ‘shape’ that you are lofting, local to the step position, then assemble all these resulting vert positions into a mesh using the Mesh class
Thanks for answer. Its nice way to do it.
So i tried and i did half of thing, im not very good with mesh class. So i have made Step points on path and made their offsets and i have added them to vertices holder of mesh, my question is now how i will hande uv and triangles?
if you have the vert indices doing something sensible like
0 1
2 3
4 5
then the tris array goes 012213 234435 456657 etc…
For uvs, you probably want all the left verts to have u=0, and right side u=1 (or viceversa);
Then v starts at 0 for the first pair, then increases by the step distance, so for those first 6 verts, if the strip is 2 units long, and each path step is every 1 unit
0,0 1,0
0,1 1,1
0,2 1,2
or if you want the entire length of the strip to equal one texture cycle, you have to divide each v by the total length of the strip