#issnt it smarter to make a thread

1 messages · Page 1 of 1 (latest)

winter meteor
#

.

#

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

dense cape
#

And what is expected result

winter meteor
#

do you mean what i hope to get out of it?

dense cape
#

You need to be specific what you want and what doesn't work

#

Yeah

winter meteor
#

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

dense cape
#

So you're saying it's generating same mesh every 10x10 and that's problem?

#

Am I understanding correct? 🤔

winter meteor
#

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

rancid swift
#

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

winter meteor
#

uhmm no im generating multiple meshes right? the maze is still one Grid grid

#

with length 20x20

dense cape
#
Cell cell = grid.cells[x, y];

So isn't this always same cell per every 10x10?

winter meteor
#

no that grid is 20x20

dense cape
#

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)));
dense cape
#

So it should be

Cell cell = grid.cells[x + (i * 10), y + (j * 10)];
#

If cells is 20x20

winter meteor
#

DAMN

#

i think thats the problem

#

wait

#

is it

dense cape
#

It should be, it seems like cell is where you get wall information.

#

So you get same cell, you get same walls

winter meteor
#
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?

dense cape
#

Try that

winter meteor
#

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

rancid swift
#

That looks like the MazeGenerator.. the code you shared doesn't actually draw the maze path, as far as I can see.

dense cape
#

You wrote x + (j * 10)

winter meteor
#

also for the y and the other side?

dense cape
#

Of course it's j for y side

#

Is that code yours or is it tutorial thing

winter meteor
#

its fully mine

#

no tutorial

dense cape
#

Then why don't you understand your own logic

winter meteor
#

i'm sorry XD

dense cape
winter meteor
#

i have that

#

WAIT

#

you mean i and j lmao

#

sorry

dense cape
#

😇

winter meteor
#

i might need to tell you something

#

you are the most amazing person ever

dense cape
#

Thanks

#

Is it working?

winter meteor
#

YES

dense cape
#

🎉

winter meteor
#

ill have to fix the edges there myself

dense cape
#

That look nicer

winter meteor
#

i don't know how it does that but i will find out some how

dense cape
#

Good luck