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.
The technique is usually called lofting 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 http://docs.unity3d.com/Documentation/ScriptReference/Mesh.html
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 Code (csharp): 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 Code (csharp): 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 Code (csharp): 0,0/length 1,0/length 0,1/length 1,1/length 0,2/length 1,2/length FYI the procedural assets project on the asset store (is free) has an example of all this, probably a good thing to read through
Thanks for your help. And for other guys that are like me , here is awesome article about unity meshes and procedural code: http://gamasutra.com/blogs/JayelindaSuridge/20130903/199457/Modelling_by_numbers_Part_One_A.php