# Procedural mesh stupid question but Im blocked

Hi all i have this
mesh.vertices = vertices;
mesh.triangles = triangles;

and would a wanna achieved is draw quads based on the info stored for debug purpose i use

Debug.DrawLine(p0, p5, Color.green);
Debug.DrawLine(p5, p4, Color.green);
Debug.DrawLine(p4, p0, Color.green);
Debug.DrawLine(p0, p1, Color.green);
Debug.DrawLine(p1, p5, Color.green);
Debug.DrawLine(p5, p0, Color.green);

but i can not get the right order to p0,p1… and when i draw a got a mess anyone can help me out here. ? how can i use the mesh info to draw thow triangles representing a quad
cheers

Not sure to understand what you are trying to do.

You want to build a mesh right ? Do you have all your vertices in correct position ?

Does your Debug.drawlines display the shape of your mesh ? Can we see it? How many vertices have you? Do you want to build a method to generate a mesh or do you just need to build this specific mesh and use it as a 3D model ?

So at the end: what are you trying to achieve ? What do you already have ?

Thanks for the replay @Thibault-Potier yes i building a mesh (an sphere with some deformations) i have de mesh perfect render but when i try to use de debug.drawline i cannot figure out how to do it… mainly i want to draw the wad formed by the 2 trianges.The data on mesh.vertices and mesh.triangles are correct.

Here you can found a detailed example of how to build a quad via scripting:

Here is the code on how i generate the mesh

``````  triangles[triIndex] = i;
triangles[triIndex + 1] = i + resolution + 1;
triangles[triIndex + 2] = i + resolution;

triangles[triIndex + 3] = i;
triangles[triIndex + 4] = i + 1;
triangles[triIndex + 5] = i + resolution + 1;

triIndex += 6;
``````

and ai would like to do is something like

Debug.DrawLine(vertices[triangles], vertices[triangles], Color.green);
… and so on but i can figure out how to traverse the vertices[ ] and triangle array

But why do you want to draw the mesh yourself? Why don’t you just put into a MeshRenderer and show it on a GO?

I render Ok, what i intend to do is draw a the faces based on 2 tris, for debug porpouse.

To that I say why climb Mount Everest? The answer…because its there.

A picture is worth a thousand words…However, from what you’ve described here I think the Mesh is obscuring the lines you are drawing with the DrawLine function. Turning DepthTest off for those lines should allow them to be visible. If not…then we’ll need a picture.

Nope, it’s like 3D printing the Mount Everest and expecting realistic results.
Debug.DrawLine wasn’t made for this and it will be super slow and annoying. I’m telling you. The best course of action is to feed it into a mesh, display it with a wireframe-shader.