Spawning Blocks in a grid

Create an array that holds a grid of vectors that matches your block spacing. Then, use that array with a ForEachLoop outputting the array element to a SpawnActor or AddInstance node.

Easiest way to create the array would be to use 2 ForLoops lined up, 1 for X, and 1 for Y that use their index to increment your vector by however many units prior to adding the vector to your array.

Here is my vector array generator, but it is for hexes:

http://img.photobucket.com/albums/v129/Decimatus/Answerhub/VectorFieldGenerator2.png

You only need 2 loops, but the math on the floats with the make/break vectors should be similar.

Hello everyone i wondered how to spawn blocks in the world snapped in a grid like Andrew did in his Brick Game project but in blueprint

Thankyou but the image is way to small to understand what you told me

First of all if you want a large amount of blocks just use his plug-in.

It’s not actually a few thousand actors because that would be horrible performance wise (worse than minecraft itself and that was pretty horrible in the beginning and is still only meh).

It’s only rendering the outlines and is actually pretty ■■■■ complex.

To your question directly. Just use the normal coordinates and normalize them to your grid. With that I mean if you spawn something or break it check for the collision point and find the closest point in the grid. Your grid is for example 200x200 units large. So if you want to build a block just get the nearest point which is on that grid.

I hope this helps.

Cheers

Zeustiak- any chance you could post a high res image? You can’t read whats in that one.