- Home /
how to make an horizontal mesh? c#
I'm working in a world than generate some tiles, this tiles have over themselfs some mesh to be rendered, right now i don't have any trouble rendering the grid VERTICALLY 
 is there any way to render the tiles horizontaly without the need to actualy rotate the world? 
 Here is the mesh renderer code:
   private bool InstanceTileMesh()
     {
         try
         {
             //Create 4 Vertices
             Vector3[] vert = new Vector3[4];
             //2D
             vert[0] = new Vector3(-1, 1, 0);//0
             vert[1] = new Vector3(1, 1, 0);//1
             vert[2] = new Vector3(1, -1, 0);//2
             vert[3] = new Vector3(-1, -1, 0);//3
 
             //3D
             //vert[0] = new Vector3(-1, 1, -1);//0
             //vert[1] = new Vector3(1, 1, -1);//1
             //vert[2] = new Vector3(-1, 1, 1);//2
             //vert[3] = new Vector3(1, 1, 1);//3
 
             //Create the triangles using the vertices
             int[] tris = new int[6];
             tris[0] = 0;
             tris[1] = 1;
             tris[2] = 2;
             tris[3] = 0;
             tris[4] = 2;
             tris[5] = 3;
 
             //int[] tris = new int[]
             //{
             //    0,1,2,
             //    2,3,0
             //    //0,2,3,
             //    //3,1,0
                 
             //};
 
             //Create a new mesh and pass down the vertices and triangles
             Mesh mesh = new Mesh();
             mesh.vertices = vert;
             mesh.triangles = tris;
 
             mesh.RecalculateNormals();
 
 
             //<--------------------------------------------->
             //Make sure than can interact with MouseController
             if (!this.tile_GO.GetComponent<BoxCollider>())
                 this.tile_GO.AddComponent<BoxCollider>();
 
             this.tile_GO.GetComponent<BoxCollider>().size = new Vector3(this.tile_GO.GetComponent<BoxCollider>().size.x * 2, this.tile_GO.GetComponent<BoxCollider>().size.y * 2, this.tile_GO.GetComponent<BoxCollider>().size.z / 90);
             //<--------------------------------------------->
 
             //Make sure mesh filter and mesh renderer componenets are attached
             if (!this.tile_GO.GetComponent<MeshRenderer>())
                 this.tile_GO.AddComponent<MeshRenderer>();
 
             if (!this.tile_GO.GetComponent<MeshFilter>())
                 this.tile_GO.AddComponent<MeshFilter>();
 
             /*if (!this.tile_GO.GetComponent<Tile>())
                 this.tile_GO.AddComponent<Tile>();*/
 
             this.tile_GO.GetComponent<Tile>().Instance = this.ToJson();
 
             //Pass down the mesh data to mesh filter
             this.tile_GO.GetComponent<MeshFilter>().mesh = mesh;
             //Send material data to mesh renderer
             this.tile_GO.GetComponent<MeshRenderer>().material = WorldController.Instance.MaterialForTiles;
 
             this.ChangeColor(this.colourName);
             //Debug.Log("Tile Renderer Bounds: "+this.tile_GO.GetComponent<MeshRenderer>().bounds.size);
             return true;
         }
         catch (Exception ex)
         {
             Debug.Log("InstanceTileMesh() Error: " + ex.ToString());
             return false;
         }
     }
 image as of right now  
 
 Have in consideration than, if i uncomment the 3D vertices and comment the 2D ones, the white thingy is not gonna render anymore and they are not gonna change the form or order of themselfs. 
 Before you ask, yes, i'm aware i can rotate the world, but i don't want to do it. 
 And yes, i'm aware than that is gonna request the world to generate horizontaly instead of vertically 
 Also yes, i also try to change "Y" for "Z" values to no avail, that's why this question is here 
 If you have any comment, request for clarification, or some other constructive comment to improve this question, please, feel free to do a coment about it and i see if it can be implemented 
Thanks a lot
 3D
             vert[0] = new Vector3(-1, 1, -1);//0
              vert[1] = new Vector3(-1, 1, 1);//1
              vert[2] = new Vector3(1, 1, 1);//2
              vert[3] = new Vector3(1, 1, -1);//3
What do you mean by "to no avail"? What happens when you change them?
This is not an answer. I've converted it into a comment. Cherno's comment actually would almost count as answer ^^.
Your answer
 
 
             Follow this Question
Related Questions
Generating unique vertices for a procedural mesh 2 Answers
Shadow artifects on mesh with Standard shader 1 Answer
Seam on Procedural Mesh 1 Answer
Flat shading procedural generated mesh? 1 Answer
Triangles overlapping in mesh 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                