# Spawning an actor in-game on a grid

I am fairly new to unreal engine, and this kind of things in general, so i have problems figuring out how to do this.

What i’m trying to do is to be able in-game to place shapes besides, and on top of each other. I have played around with different things but cant figure out how to spawn a actor in the middle of the view, and then let it snap to the ground/top of another shape.

btw. I am using blueprints.

First of course you will want to make a grid. For 2D, an array of Vectors is basically what you want. If this is 3D, then you might need an array of vectors for each Z grid value. So if it is 10 grid points tall, then 10 Vector Arrays.

Do you want these objects to spawn out of place and then visibly snap together, like magnetically? That could be a complicated process of searching for nearest grid or attach points, moving or animating from current location to new location, and properly lining up with adjacent objects.

If you just want them to spawn already in place, then it is just a matter of determining what exact vector grid point they will use for their spawn transform.

If this doesn’t get you in the right direction I am going to need more information about what you are actually trying to do.

What i am trying to do, is kind of making a building system similar to say Minecraft, but not restricted to only cubes, but with shapes in general.

I don’t have to much experience so this may be a little too ambitious, but i just want a basic way to be able to spawning a shape in my view that spawn already in place. (maybe snaps on a invisible grid) No need for animation. I also want a preview of what i’m placing.

I understand that you cant teach me how to do all this, so i appreciate all the help i can get. Thanks allot!

You should probably figure out how to do boxes first and then move up to oddball shapes…

Either way your oddball shapes will basically want to use the same 3d grid as the boxes, so you should probably start with the grid.

Take a look at Everquest Landscape. They have a voxel world but it is smoothed somehow. Probably require some C++, or at least some material/shader wizardry.

There are also a few other people doing Voxel projects in UE4 so you might want to search them out and see what they are up to.

Hi sorry for resurrecting this ,
Did you have any luck with different shapes , I got it to work with blocks but not different dimensions etc. if so I would very much appreciate if you shared what you found .

Many Thanks