How to fill grid base ground when the object pass ?

I want to make grid base game. When the object pass over a grid, the grid should be filled with a color(like Fill Color 3D game). But Idk how to deal.

i would create a separate plane object, which

  • copies the player location
  • snaps this location to the grid
  • sets the z-position to ground height,

so you always have a colored plane beneath the player. this makes it look like the grid patch was filled