I’ve created a hexagon using script
using UnityEngine;
using System.Collections;
public class someScript : MonoBehaviour {
public float height = 50f;
public float width = 50f;
public float depth = 0;
void Start () {
MeshFilter mf = GetComponent();
Mesh mesh = new Mesh();
mf.mesh = mesh;
Vector3[ ] vertices2 = new Vector3[6];
float x = 0;
float y = 0;
float r = 10;
float n = 6;
for (int i = 0; i < n; i++)
{
float xPos = x + r * Mathf.Cos(2 * Mathf.PI * i / n);
float zPos = y + r * Mathf.Sin(2 * Mathf.PI * i / n);
Debug.Log("xPos1 " + xPos);
Debug.Log("zPos1 " + zPos);
vertices2 = new Vector3(xPos, 0, zPos);
};
int[ ] tri2 = new int[12];
tri2[0] = 2;
tri2[1] = 1;
tri2[2] = 0;
tri2[3] = 3;
tri2[4] = 2;
tri2[5] = 0;
tri2[6] = 4;
tri2[7] = 3;
tri2[8] = 0;
tri2[9] = 5;
tri2[10] = 4;
tri2[11] = 0;
Vector3[ ] normals2 = new Vector3[6];
normals2[0] = -Vector3.forward;
normals2[1] = -Vector3.forward;
normals2[2] = -Vector3.forward;
normals2[3] = -Vector3.forward;
normals2[4] = -Vector3.forward;
normals2[5] = -Vector3.forward;
Vector2[ ] uv2 = new Vector2[6];
uv2[0] = new Vector2(0, 0);
uv2[1] = new Vector2(1, 0);
uv2[2] = new Vector2(0, 1);
uv2[3] = new Vector2(1, 1);
uv2[4] = new Vector2(1, 1);
uv2[5] = new Vector2(1, 1);
mesh.vertices = vertices2;
mesh.triangles = tri2;
mesh.normals = normals2;
mesh.uv = uv2;
}
}
When I render it with adding simple color material - it looks like this:
But when Im adding some image on it -
Half of the hexagon looks fine - but the other part is smoothed, any idea where can be the problem?