Search Unity

Terrain Grid

Discussion in 'Editor & General Support' started by BigBird, Mar 23, 2010.

  1. BigBird

    BigBird

    Joined:
    Mar 23, 2010
    Posts:
    3
    Hi,
    First sory for my bad English I’m French .
    I have been playing with unity for some time now, and i wanna start making my own game but I need some hints on how to do it .
    I would like to make some kind of tactics game that look like this :



    I wonder what’s the best way to draw the terrain grids and color quads where player can move.
    Can someone point some hints ?


    thanks,
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Hi, welcome to the forum!

    If the ground is a plane, you might be able to place another plane over the top and colour it in where necessary. You can use the Texture2D class to draw lines and coloured areas into a texture and apply this texture to the overlaid plane.
     
  3. sycren

    sycren

    Joined:
    Mar 10, 2010
    Posts:
    18
    Ok, so by this you mean take the terrain. For the part you want to have the grid, duplicate it and give it a Texture2D which is a grid tiled?

    Or do you mean to make a tile object with its own texture for each tile....?
     
  4. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    You could make lots of separate tile objects of the right colour and place them over the appropriate squares. But another way to go is to use the Texture2D class to draw into the texture itself. You would draw gridlines on the texture and then fill in the squares with the appropriate colour (or a colour with 100% transparency if that square is not to be displayed).

    Which of these two methods is best depends on how many tiles you need to draw, how complicated the pattern of tiles is, etc. If you need to show a large grid with many tiles accessible, you might get better performance by using the Texture2D approach. If using separate tile objects is not too much of a performance hit, then that is probably easier.
     
  5. BigBird

    BigBird

    Joined:
    Mar 23, 2010
    Posts:
    3
    thanx for replys

    so the best way is to draw my grid and colored shapes inside a big Texture2D.
    Should i and use a projector to project it on the terrain?
     
  6. BigBird

    BigBird

    Joined:
    Mar 23, 2010
    Posts:
    3
    i don't have too bad results using a projected 2d tiled texture



     
  7. MarkPixel

    MarkPixel

    Joined:
    Apr 15, 2010
    Posts:
    39
    could you explain a little bit, how this was done?
    maybe like a tutorial?
     
  8. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    It's exactly what he said it was. Just include a border in your terrain texture and have its size match your desired grid size.