Created
October 20, 2022 14:11
-
-
Save barleymalt/bf50c7b961a021ff29122c39a8bad71d to your computer and use it in GitHub Desktop.
a simple gist to create a grid of vertices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// catlike coding | |
private Vector3[] Generate(int xSize, ySize) | |
{ | |
Vector3[] vertices = new Vector3[(xSize + 1) * (ySize + 1)]; | |
for (int i = 0, y = 0; y < ySize; y++) | |
{ | |
for (int x = 0; x < xSize; x++, i++) | |
{ | |
vertices[i] = new Vector3(x, y); | |
} | |
} | |
return vertices; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment