#issnt it smarter to make a thread
1 messages · Page 1 of 1 (latest)
.
okay so im trying to generate a maze. using a grid of cells and 100x100 cells are one mesh but then this happens
i have looked to this piece of code for an hour now XD
And what is expected result
do you mean what i hope to get out of it?
well as im generating a 20x20 grid in the picture its making a copy of grid 0.0 to 10.10 4 times
cus i made 4 meshes 10x10 for every mesh
so i guessed that there was something wrong with that script
but i wassnt able to find it
So you're saying it's generating same mesh every 10x10 and that's problem?
Am I understanding correct? 🤔
i think so yeah
i'd rather screenshare the problem but it was against the server guide lines😅
but as far as i tested im sure its the script i sent as a link
cus generator goes to pos 19,19
but its just not visible after 9,9
You're instantiating a new MazeGenerator (whatever that is) for each i and each j so it would seem you're generating multiple mazes
rather than generating a single maze
uhmm no im generating multiple meshes right? the maze is still one Grid grid
with length 20x20
Cell cell = grid.cells[x, y];
So isn't this always same cell per every 10x10?
no that grid is 20x20
But x, y is 0, 0 in new loop
Aren't you suppose to use same variable with
Debug.Log(x + (i * 10) + "," + (y + (j * 10)));
what do you mean by that
So it should be
Cell cell = grid.cells[x + (i * 10), y + (j * 10)];
If cells is 20x20
It should be, it seems like cell is where you get wall information.
So you get same cell, you get same walls
for (int x = 0; (x + (i * 10)) < (CalculateLeftOver(width, i) + (i * 10)); x++)
{
for (int y = 0; (y + (j * 10)) < (CalculateLeftOver(height, j) + (j * 10)); y++)
{
Debug.Log(x + (i * 10) + ",," + (y + (j * 10)));
Debug.Log(i + "," + j);
Cell cell = grid.cells[x + (j * 10), y + (j * 10)];
quads quads = new quads(x, y);
Vector2[] uv = getUvs(cell);
//for 5 faces
for (int k = 0; k < 5; k++)
{
if (cell.walls[k] == true)
{
Vector3[] v = quads.Face(k);
//for 2 triangle corners
for (int l = 0; l < 6; l++)
{
vertices.Add(v[l]);
triangles.Add(triangles.Count);
uvs.Add(uv[l]);
}
}
}
}
}
so like this?
Try that
it kinda works
this is the second time i ran this
but when it gets to the top half it doessnt work
and it still duplicates the bottom
That looks like the MazeGenerator.. the code you shared doesn't actually draw the maze path, as far as I can see.
You wrote x + (j * 10)
It's x + (i * 10)
also for the y and the other side?
Then why don't you understand your own logic
i'm sorry XD
Just do exactly this lol.
😇
YES
🎉
That look nicer
i don't know how it does that but i will find out some how
Good luck