Grid Based Building/Placement System

Hey guys, as part of a large project I need to create a grid based terrain from heightmap, and on that terrain I need to be able to overlay a transparent grid texture.

This grid/terrain also needs to be fully functional, i.e. if a tile on the grid is clicked, an object needs to be placed within it. There are different types of object, i.e. floor, wall and roof… and as such each tile will need to be able to hold one of these objects.

I come from a Unity background, so I don’t have much experience with Babylon and TS. I was wondering if anyone had any pointers as to how something like this could be achieved. Many thanks, Cameron.

@mackey has definitely done similar things in the past and @jerome for tiled terrain :slight_smile:

1 Like

For the heightmap terrain you may try Dynamic Terrain | Babylon.js Documentation

2 Likes

Bump

This might help as well Creating A Tiled Ground | Babylon.js Documentation and I am pretty sure @MackeyK24 will be jumping in here soon

1 Like

Thanks @sebavan … I really appreciate the help!

As for the tiled ground, I dont think that will work for me as I already have a terrain from heightmap in the scene that I want to use that dosnt use multi-textures, I just want to create a grid overlay ontop of a flat section of this and segregate this into 1x1 sections… hoping it can be done!

Could you add a plane with the GridMaterial on it just above the ground if it is flat ?

1 Like

Thanks @sebavan , the GridMaterial method worked well and provides a better result to what I had done previously. This is the scene in its current state. Now I just need to somehow provide functionality to click on a section within the grid, and to carry out actions such as placing objects, modifying existing objects etc based on the grid.

1 Like