I have created lists for storing the Vertex, Triangle and UV data. I am using lists as they dynamically resize, and there for I can add many different vertices, triangles and uv coordinates.
The first step to building the mesh was to define the vertices.
Values for building a Square |
Values for building a Hexagon |
After defining the vertices, I needed to build the triangles using the vertices I've just created. For the square, I only need 2 triangles [0,1,3] and [1,2,3].
However building the hexagon, needed 4 triangles([1,5,0], [1,4,5],[1,2,4] and [2,3,4])
To work out how to build the meshes, I created some 'sketches' in order to know the vertices and triangles that I would need when coding.
Shows the vertices & triangles that I used to create the square mesh |
The vertices & triangles I used to create the hexagon mesh |
After building the triangles, I needed to set the UV Coordinates. UV Coords are a type of mapping that define the application of a 2D texture to a 3D object. This is done by giving each vertex a position on the texture, and that position corresponds to the colour on the texture that vertex should be.
--------------------------------------------------------------------------------------------------------------------------
Here is the square shown in the Scene screen in Unity. You can see how the triangles have been drawn |
Here is the Hexagon shown in the Scene screen in Unity. You can see how the triangles have been drawn |
These are the what I have produced so far. Next step is to create a flat plane of these meshes and then building upon the meshes further and creating a cube, and then following on from that and building the hexagonal prism that will be the foundation of my project.
No comments:
Post a Comment