#Help turn 1D Prefab Generator into 2D One

1 messages · Page 1 of 1 (latest)

cerulean tartan
#

Howdy, i have a little script that generates a random prefab from a list along the Z Axis. it was used for a road generator but i want to convert it into a 2d generator that generates on Z,-Z,X,-X.

#

i was also testing a little "safe zone" where it removes the chunks that the player is not near

#

if i could get any help on how i could go doing this i would really appreciate it.

mental marten
#

I'm not quite sure on what the code does. Basically it instantiate a new chunk only in the z axis?

#

I was thinking these days how Minecraft handles the management of chunks and render what is in the world. I was convinced that keeping track of the player's current position is not good. So, as I love callbacks, I thought that having movement called be player on changing it's current chunk position would be a great way to handle that situation

#

I mean, these way the chunk controller would subscribe to player's chunk change callback and handle what needs to be changed at all

#

U do not need to check the player's current position each frame anymore

#

About the x, -x chunk spawn a simple for could solve your problem. Assuming that u know how long the x and z gonna be, make a for (int I = 0; I <= rows; I++) the same for z ans column