- Home /
Creating a mesh out of a linerenderer - how do you convert revolved vertices set to triangles and uv's
Suppose you draw a line using linerenderer (and also have an array of points) - how do you turn that into a mesh?
To elaborate on my question... As I understand, you will need triangles and uv's - not just vertices...
So, suppose you rotate about a circle each of the points on the 1-d line along its local y (or z axis), the one perpendicular to the plane of the line. How do you convert these to triangles and uv's?
The pictorial equivalent is a lathe - which starts out as a 1-d line in a plane, which you simply rotate about a circle in the perpendicular direction:
So, in sum:
- I know how to generate the vertices.
- I am not sure how to generate the triangles - are they simply, count the vertices from 0?
- I am not sure how to generate the UV's - conformal mapping of the 3d mesh to a plane?--
What is it that you need to do, which cannot be done with a Line Renderer, but is similar enough that you referenced it? You can certainly recreate what the Line Renderer does, but that would be pointless, unless it is limiting you somehow.
I don't understand your last paragraph; a diagram would probably help.
Why are you using the terms "1D line"? That's a segmented curve, not a line, and it is clearly exists in two dimensions. I understand that you want to revolve a curve, not a shape that exists in a plane, but calling it 1D is poor wording. Additionally, you are never extruding vertices perpendicular to the plane that anything is in; that's the definition of a circle/lathe.
sorry, it's a 1d curve from math (parametrically, at least - an object moving on the line only has one degree of freedom), but it might be called something else in other parlance
no extrusion.. never mentioned extrusion... the rotation is along an axis perpendicular to the plane of the line
Answer by Jessy · Jan 01, 2011 at 08:16 AM
You cannot read data from a Line Renderer, so a direct conversion is impossible, without copying and pasting in the Editor.
Edit: Now that you've altered your question, check here. Using "LineRenderer" in the title is misleading; this has nothing to do with Line Renderers. A "lathe" is indeed what you should be asking about.
As for UVs, who knows what you want to do with that. Trying to texture something like this, in a non-abstract way, without actually using a modeling program, will be ridiculous.
Well you would also have an array of points (convertible to vertices) - the line renderer simply renders the array of points.
Who says? There's no requirement to keep the array around. If you were to just populate it in the Editor, you'd have no way of accessing that data, again, other than copy and paste for every Vector component. I don't understand the logic of exposing that array in the Editor, when you can't alter it programmatically, but that's how it is for the time being?
Well, you don't have to expose that points array - it could be a private global var.. Anyway your S/O link is totally useless... As mentioned in the bullet points, I know how to generate the vertices (which are just points rotated in a circle), I'm just not sure how to turn a bunch of vertex points into a mesh.
If you have all the vertices you need, then just connect them: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$esh-triangles.html