Search Unity

Tunnel making mesh

Discussion in 'Scripting' started by Reeceg, May 25, 2015.

  1. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Does anybody now of a method to push and extend the amount of triangles on a mesh to make it look like your digging a tunnel. Ive been researching marching cubes for a while and have gotten nowhere.
     
  2. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    I've seen it done quite well in some Voxel based Unity projects, but I assume you're looking for a way to do this with a standard mesh &/or terrain?
     
  3. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Well I don't really mind what the method is as long as you know where I could learn to do it weather it be a tutorial, source code or just some tips.

    Edit: Sorry but to answer your question no I want to make the terrain at the start of the scene and be able to edit it.
     
    Last edited: May 26, 2015
  4. Stef_Morojna

    Stef_Morojna

    Joined:
    Apr 15, 2015
    Posts:
    289
    A long ago I saw a .gif that did something similar to what you are describing.

    What they did was something similar to this.


    Edit: I was thinking a bit around and what you could do for better performance:
    Making the areas that are whole into bigger squares and only separate then in 4 when needed.
     
  5. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Im afraid my internet is not being very compliant right now so I cant see the gifs you posted but is it something like.
    Code (CSharp):
    1. void Start ()
    2.     {
    3.         for (int a = 0; a < HightY; a++)
    4.         {
    5.             for (int b = 0; b < LengthX; b++)
    6.             {
    7.                 GameObject P = Instantiate(VoxelPoint, new Vector2(a,b), Quaternion.identity) as GameObject;
    8.                 P.transform.localScale = new Vector3(1,1,1);
    9.             }
    10.         }
    11.     }
    with each point making a square based on the other voxels positions. Ive done something like this before but I had no way to insert more voxels into the mesh to relive the stretching of the mesh.
     
  6. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Doe anybody have an idea as to how I should store the voxels in my attempts I stored them as gameobjects so I could move them.
     
  7. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
  8. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Yeah this is a great tutorial I just don't know if I could apply the block system to marching cubes for smooth terrain. If anybody who has read this tutorial do you think the knowledge could be applied to this?
     
    krougeau likes this.
  9. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    So glad it's of use to you :) While you're waiting for confirmation here, might I suggest that you pose your question on the seemingly still active tutorial thread? It appears to have quite a few active users, so perhaps they'll be a bit more knowledgeable as to the specifics of what you'll need. In the meantime, best of luck! I'll be studying the tutorial myself shortly as it looks like great information. Have fun!
     
  10. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    The thread is from 2013 Im not sure but is that considered active.
    P.S a friend just said that what I said could be considered sarcastic but Im seriously asking Im fairly new to unity forums.
     
  11. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
  12. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    Oh God Im an imbecile I was looking at the date joined, sorry.
     
    krougeau likes this.
  13. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    LOL! No worries, it happens ;) On a separate note, is anyone else having trouble reaching the main Unity Forums link? I've been getting errors for hours now and can't reach the main page.
    http://forum.unity3d.com/
    Unity Community - Error
    The requested page could not be found.
     
  14. Reeceg

    Reeceg

    Joined:
    May 14, 2014
    Posts:
    30
    No it works for me.
     
    krougeau likes this.
  15. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Good to know! Probably just need to reboot my browser then. Thanks!

    Update: Turned out to be some idiocy brought to me by AT&T, lol. Had to clear my cache and restart, all is well now. Thanks again!
     
    Last edited: May 27, 2015