I m trying to build minecraft type of game with more complex builds like that of fortnite, so I wanted to start with the best practices i have to follow to create those builds.

the blocks in minecraft are aligned with proper precision to create those humongous buildings and arts needs to have some kind of alignment algorithm that the developers must have followed. similarly, fortnite follows placement of walls and roof with proper precision.In fornite when the player places a stair it takes some area of the space and when you try to place another stair on the same level a little forward it leaves some space and places another stair after some distance of the first floor....like a stair takes a cube space around itself and then places another after another cube space distance.

now the tricky part is when the player places a stair and goes up to place another stair right above the first one to reach height, what transform position does the second floor needs to have to connect itself to the previous builds.

any suggestions or ideas on how have they achieved this would be a great help!Thanks!

  • \$\begingroup\$ In the case of Minecraft, this is pretty simple. You take the world space coordinates for where the player clicked, transform them to block space, and round them to the nearest block coordinate. Are you asking about the mechanics of how to do that? \$\endgroup\$
    – Ryan1729
    Aug 13, 2019 at 7:07
  • \$\begingroup\$ @Ryan1729 the actual process not the theoretical...how would i start the process i m quite confused on where to start \$\endgroup\$
    – zsshan07
    Aug 13, 2019 at 11:02
  • \$\begingroup\$ I think both games are just snapping to a regular grid, are they not? Have you consulted past Q&A about snapping/rounding to grids? You may find the answers you need have already been written. If you run into any specific trouble putting these answers into practice, please edit your question to clarify where exactly you're stuck. \$\endgroup\$
    – DMGregory
    Aug 13, 2019 at 11:07

1 Answer 1


There are multiple approaches how you can achieve a good placement snapping.

I personally don't know Fortnite enough to be able to tell you what approach they are using.
I would guess it's some kind of snapping points and a clever decission algorithm on which point to take.

Here's a list with some snapping techniques that I know of.
This list is not a complete one, there are countless ways how you can do snapping.

Using a 3d grid, in which you can place object is basically how Minecraft does it.
In essence you calculate to which cell the cursor points, then you add the object to the cell.
You can then test the properties of neighbor cells to determine the final shape, orientation, etc. of your new object.
Example game: Minecraft

  • Local grid:
    Instead of using a world grid like in minecraft, you can also use local grids.
    Let's say the player should be able to place something freely on a terrain.
    But when the player tries to place something on top of that other something, it should use a grid snapping relative to that first object.
    This can be done by creating a new grid everytime something is not placed in a grid.
    Now when you try to place an object on another object, you check whether that other object belongs to a grid, and if yes, place it in the grid. If no, create a local grid.
    Example game: Space Engineers

Snapping points:
Snapping points are locations on your meshes where other meshes can snap to.
If two points snap, the object to be placed gets moved, rotated, scaled or modified, such that both points are at the same place and the snapping criteria is fullfilled.
In case of stairs, the stair would have a snapping point at the top and the bottom of the stairs.
To determine whether two objects can snap, there are also multiple approaches, such as nearest point, look direction, something you come up with or even combinations of them.
Example game: Kerbal Space Program

  • Snapping point classes:
    As extension of the snapping points, you can also classify a snapping point, such as "Big object", "Ornament", etc and only snap to snapping points that match a filter criteria.
    This can be usefull if certain objects are only allowed to snap to certain snapping points.

Line snapping:
Instead of points, one could also snap to a line.
Just define lines along your object that allow snapping.
Then snapp to the nearest point on the nearest line.
Example game: Don't know...

Vertex snapping:
Just use the mesh vertices as snapping points.
This is usually done in CAD, I haven't seen it in games.

  • \$\begingroup\$ thanks for the answer it is something that i can add up on...really appreaciate it:) \$\endgroup\$
    – zsshan07
    Aug 14, 2019 at 5:34
  • \$\begingroup\$ I think the snapping points are the best option for a game like fortnite. \$\endgroup\$
    – Millard
    Sep 2, 2019 at 15:56
  • \$\begingroup\$ Yes, generally for irregular shapes, snapping points are the usual way to do it. Grid snapping is more usefull for regular shapes like cubes. \$\endgroup\$ Sep 3, 2019 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .