Ground grid? Please help 💖

Hey guys, I was wondering if there’s a way to do this in babylon? Basically I’d like to have the ground have a grid

Like so:

Futura_-_grid_black_600x

And have to where if I tell the mesh to move to 2,3 it would move to the center of this tile:

Futura_-_grid_black_600x~2

But in a 3d perspective? I’m not sure if I’m making much sense here, so feel free to ask questions and I’ll clarify as best as I can?
I’m unsure if anyone here is familiar with the ‘RuneScape’ movement where if you click on tile (3422, 3200, 1) you’d walk to that tile?

It’s a fairly common question. Don’t feel bad. Yes is the answer. You are basically creating an RTS map.

To just mimic the material, explore the gridMaterial!
https://doc.babylonjs.com/extensions/grid

For functionality may I suggest start at thread from the old forums?


It has some sample code in one of the first reply links.

The most basic way is to create a multi-dimensional [[x,y,units],[x,y,units],[x,y,units]] array or if getting fancy a set of bitmap where each pixel is an X Y and color is representative of one game object(s))

There are a few additional forum threads along the same vein of setting up an RTS map from both the old forums and this one.

Let us know if you need more assistance.

@Calsa thanks for pointing out the grid material, hadn’t seen that yet :slight_smile: as for the rest, the forum post you linked to, didn’t help very much unfortunately. I’m hoping for a playground example :frowning:

I got you covered:

I found you a nice YouTube video series with source on creating an full RTS (including just the map piece you want)

https://doc.babylonjs.com/how_to/rts_game_development_series

3 Likes

@Calsa thank you, I was able to adapt that to exactly what I was looking for<3

1 Like

Happy to help, but don’t thank me. Thank the wonderful community member that took the time to make those tutorials. Real hero that guy.

1 Like