I’m making a mesh utilizing this code snippet.
[ContextMenu(“Generate Mesh”)]
void GenerateMesh()
{
meshHSK = new Mesh();
meshHSK.identify = “Space Mesh”;
meshFilter.mesh = meshHSK;
Vector3[] polygonPoints = new Vector3[areaPositions.Count];
for (int i = 0; i < areaPositions.Rely; i++)
{
polygonPoints[i] = areaPositions[i];
}
meshHSK.vertices = polygonPoints;
var totalVerts = meshHSK.vertices.Size;
var totalTriangles = totalVerts * 3;
polygonTriangles = new int[totalTriangles];
for (int ti = 0, vi = 0, y = 0; y < ySize; y++, vi++)
{
for (int x = 0; x < xSize; x++, ti += 6, vi++)
{
polygonTriangles[ti] = vi; //0=0 //
polygonTriangles[ti + 1] = vi + xSize + 1; //1=2
polygonTriangles[ti + 2] = vi + 1; //2=1
polygonTriangles[ti + 3] = vi + 1; //3=1
polygonTriangles[ti + 4] = vi + xSize + 1; //4=2
polygonTriangles[ti + 5] = vi + xSize + 2; //5=3
}
}
meshHSK.triangles = polygonTriangles;
meshHSK.RecalculateBounds();
//meshHSK.RecalculateNormals();
}
However right here comes the brand new factor which i need to do. Is to generate sq. mesh (with a particual distance/space). I need to divide with additional meshes utilizing a sepecific wdith top.