I want to have a map generation system reminiscent of something like Mount of the Gods.
There are probably much better ways to do this, but this is the simplest I can think of (if there is a simpler way or you have another idea please share).
Basically, it’s grid based, and I randomly choose an existing square on the grid that I want to expand off of.
I want to place a square adjacent to it, but I need to know not to place land there if there is already a piece of land there, so my idea was to check a the vector3 coordinate to determine if a part is there. Is this possible?
NOTE: While writing this, I thought a better idea might be to instead check the parts to determine if it is at the coordinate? Like, have a table of all the land pieces and loop through to check if their position is equal to the position I want to move them to? Is that the best way to do that? Is there a better way? Please do share any ideas or feedback you have
Expanding off what you said, if you wanna loop through even less objects, divide the grid into different sections so you don’t have to loop through the entire thing to check if the position is available. Instead you can loop through the section you’re placing into which would be more efficient.
Why don’t you just clone a temporary part in, move this temporary part to the coordinate, and check GetTouchingParts to see if it overlaps anything? Wouldn’t that be easier than looping through everything?