Heya,
I am generating cubes with my code (actually these are walls, but should not make a difference here) and I can’t find the reason why the bottom is not drawn. While it is not crucial for the project itself (you won’t be able to see the bottom of the wall anyways) I’d like to know if there is an mistake in my code which I can’t find.
I marked the spot where I suspect the error with “NEEDS CORRECTION!”
vertices[tileCounter*24+00] = leftBtmFront;
vertices[tileCounter*24+01] = rightBtmFront;
vertices[tileCounter*24+02] = leftTopFront;
vertices[tileCounter*24+03] = leftBtmBack;
vertices[tileCounter*24+04] = rightBtmBack;
vertices[tileCounter*24+05] = rightTopFront;
vertices[tileCounter*24+06] = leftTopBack;
vertices[tileCounter*24+07] = rightTopBack;
vertices[tileCounter*24+08] = leftBtmFront;
vertices[tileCounter*24+09] = rightBtmFront;
vertices[tileCounter*24+10] = leftTopFront;
vertices[tileCounter*24+11] = leftBtmBack;
vertices[tileCounter*24+12] = rightBtmBack;
vertices[tileCounter*24+13] = rightTopFront;
vertices[tileCounter*24+14] = leftTopBack;
vertices[tileCounter*24+15] = rightTopBack;
vertices[tileCounter*24+16] = leftBtmFront;
vertices[tileCounter*24+17] = rightBtmFront;
vertices[tileCounter*24+18] = leftTopFront;
vertices[tileCounter*24+19] = leftBtmBack;
vertices[tileCounter*24+20] = rightBtmBack;
vertices[tileCounter*24+21] = rightTopFront;
vertices[tileCounter*24+22] = leftTopBack;
vertices[tileCounter*24+23] = rightTopBack;
//front and back
uv[tileCounter*24+00] =new Vector2(0,0);//linksUntenVorn
uv[tileCounter*24+01] =new Vector2(1,0);//rechtsUntenVorn
uv[tileCounter*24+02] =new Vector2(0,1);//linksObenVorn
uv[tileCounter*24+03] =new Vector2(0,0);//linksUntenHinten
uv[tileCounter*24+04] =new Vector2(1,0);//rechtsUntenHinten
uv[tileCounter*24+05] =new Vector2(1,1);//rechtsObenVorn
uv[tileCounter*24+06] =new Vector2(0,1);//linksObenHinten
uv[tileCounter*24+07] =new Vector2(1,1);//rechtsObenHinten
//left and right
uv[tileCounter*24+08] =new Vector2(1,0);//rechtsuntenvorn1,0
uv[tileCounter*24+09] =new Vector2(1,0);//rechtsuntenhinten1,0
uv[tileCounter*24+10] =new Vector2(1,1);//rechtsobenvorn1,1
uv[tileCounter*24+11] =new Vector2(0,0);//linksuntenvorn0,0
uv[tileCounter*24+12] =new Vector2(0,0);//linksuntenhinten0,0
uv[tileCounter*24+13] =new Vector2(1,1);//rechtsobenhinten1,1
uv[tileCounter*24+14] =new Vector2(0,1);//linksobenvorn0,1
uv[tileCounter*24+15] =new Vector2(0,1);//linksobenhinten0,1
//top and bottom
//************************NEEDS CORRECTION!*************bottom not displayed correctly
uv[tileCounter*24+16] =new Vector2(0,0);//linksUntenHinten-0,0
uv[tileCounter*24+17] =new Vector2(0,1);//rechtsUntenhinten-0,1
uv[tileCounter*24+19] =new Vector2(1,0);//linksObenhinten-1,0
uv[tileCounter*24+20] =new Vector2(1,1);//rechtsObenHinten-1,1
//************************NEEDS CORRECTION!*************
uv[tileCounter*24+18] =new Vector2(0,0);//linksUntenVorn0,0
uv[tileCounter*24+21] =new Vector2(1,0);//rechtsUntenVorn1,0
uv[tileCounter*24+22] =new Vector2(0,1);//linksObenVorn0,1
uv[tileCounter*24+23] =new Vector2(1,1);//rechtsObenVorn1,1
triangles[tileCounter*36+00] =00+tileCounter*24;//leftBtmFront
triangles[tileCounter*36+01] =02+tileCounter*24;//leftTopFront
triangles[tileCounter*36+02] =01+tileCounter*24;//rightBtmFront
triangles[tileCounter*36+03] =01+tileCounter*24;//rightBtmFront
triangles[tileCounter*36+04] =02+tileCounter*24;//leftTopFront
triangles[tileCounter*36+05] =05+tileCounter*24;//rightTopFront;
triangles[tileCounter*36+06] =03+tileCounter*24;//leftBtmBack;
triangles[tileCounter*36+07] =00+tileCounter*24;//leftBtmFront
triangles[tileCounter*36+08] =01+tileCounter*24;//rightBtmFront
triangles[tileCounter*36+09] =01+tileCounter*24;//rightBtmFront
triangles[tileCounter*36+10] =04+tileCounter*24;//rightBtmBack;
triangles[tileCounter*36+11] =03+tileCounter*24;//leftBtmBack;
triangles[tileCounter*36+12] =08+tileCounter*24;//leftBtmFront
triangles[tileCounter*36+13] =11+tileCounter*24;//leftBtmBack
triangles[tileCounter*36+14] =10+tileCounter*24;//leftTopFront
triangles[tileCounter*36+15] =10+tileCounter*24;//leftTopFront
triangles[tileCounter*36+16] =11+tileCounter*24;//leftBtmBack;
triangles[tileCounter*36+17] =14+tileCounter*24;//leftTopBack
triangles[tileCounter*36+18] =09+tileCounter*24;//rightBtmFront
triangles[tileCounter*36+19] =13+tileCounter*24;//rightTopFront;
triangles[tileCounter*36+20] =12+tileCounter*24;//rightBtmBack;
triangles[tileCounter*36+21] =13+tileCounter*24;//rightTopBack
triangles[tileCounter*36+22] =15+tileCounter*24;//rightTopBack
triangles[tileCounter*36+23] =12+tileCounter*24;//rightBtmBack;
triangles[tileCounter*36+24] =22+tileCounter*24;//leftTopBack
triangles[tileCounter*36+25] =19+tileCounter*24;//leftBtmBack;
triangles[tileCounter*36+26] =20+tileCounter*24;//rightBtmBack;
triangles[tileCounter*36+27] =22+tileCounter*24;//leftTopBack
triangles[tileCounter*36+28] =20+tileCounter*24;//rightBtmBack;
triangles[tileCounter*36+29] =23+tileCounter*24;//rightTopBack
triangles[tileCounter*36+30] =22+tileCounter*24;//leftTopBack
triangles[tileCounter*36+31] =21+tileCounter*24;//rightTopFront;
triangles[tileCounter*36+32] =18+tileCounter*24;//leftTopFront
triangles[tileCounter*36+33] =23+tileCounter*24;//rightTopBack
triangles[tileCounter*36+34] =21+tileCounter*24;//rightTopFront;
triangles[tileCounter*36+35] =22+tileCounter*24;//leftTopBack
For now I am only using a little image and not an image map which will be added later. So it does not matter if the image is displayed mirrored. For now I only want that it is displayed at all.
In unity it looks like this: