Search Unity

creating pseudo-destructible "terrain" grid

Discussion in 'Scripting' started by teatime, Sep 23, 2008.

  1. teatime

    teatime

    Joined:
    Jun 16, 2008
    Posts:
    129
    I am interested in creating what is essentially an update of an obscure little fixed shooter for the original Game Boy called Burning Paper, pictured here:



    In this game, the player drags a reticle along a grid, creating burn lines in large paper cards with pictures on them. If the paper is burnt in such a way that a section of it has nowhere to hang from, that piece drops straight down and takes out any enemies beneath it. I think it's a great way to introduce an almost puzzle-like strategic conservation element into what is essentially a simple shooter, and it's a shame that as far as I can tell no other game has used this mechanic since, as it would work very well with mouse or touchscreen control.

    Problem is, I haven't much of an idea where to start reproducing this in Unity. I would like to avoid using the physics engine at all costs, I think everything could be done more predictably and quickly by manipulating colliders. I'm particularly mystified as to how to make the destructible grid. I would like to use a plane mesh object containing every grid square in a card rather than individual objects for each square, as the latter would be more processor-expensive and I would like to easily stretch a texture across the whole grid. And of course one would cast a ray to determine where the reticle should be on screen, and "burn" along the edges nearest to where the reticle is being dragged when the mouse is clicked. As far as visualising that burn effect, snapping it to the grid, and determining when, where, and how to drop the "split" part of the mesh, while retaining the illusion of texture continuity, I'm pretty much lost - I'm not even sure manipulating a mesh to that extent is possible through code. I hope I've explained things well enough. Any suggestions general or specific would be much appreciated (specific suggestions will be appreciated more, of course. :) )
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sure it is. Have you used the mesh scripting interface yet? If not, I'd say go play with it for a while (there are some good examples in the procedural example projects), and I expect that would answer a lot of your questions. While this wouldn't be trivial to accomplish, it should be relatively straightforward when you understand how to build meshes from code.

    --Eric