Search Unity

Conform Terrain Script and Project

Discussion in 'Scripting' started by ikiman, Jun 19, 2009.

  1. ikiman

    ikiman

    Joined:
    Feb 19, 2008
    Posts:
    117
    At last i found time for this, please take a look:

    http://www.3dnemo.com/031_G_to_U.html

    And Thanks to my friend Fran Galvez for the first version of the script.

    It's a tutorial on how to get data from Google Earth and get into Unity, but news are that now I included a Unity project for download (go to the bottom of the page) with the needed script for the last step, conforming Unity Terrain.

    The use is very simple. In the project there are four objects, Camera, Light, Unity Terrain and one imported mesh "terrainMesh".

    The only things to know for a correct setup:

    Import a mesh and add a mesh collider to it.
    Place over a Unity Terrain object of the same size.
    Add the "Conform_Terrain" script to the Unity Terrain.
    Fill the "Imported Mesh" var with the imported object.
    Click play.

    The demo project is ready and you only need to click play to see the Unity Terrain conformed. Stop, hide the "terrainMesh" object, and deactivate the script, that's all.

    Also, you can check the Reset Terrain var to flatten the terrain again.

    WARNING: The script is slow (several seconds depending on machine) so it is executed in a Start function and must be deactivated after it makes the work.

    Please let me know about any issue.

    Thank you and enjoy.
     
  2. KEMBL

    KEMBL

    Joined:
    Apr 16, 2009
    Posts:
    181
    Tnx! Great technique, for my town resolution was very small, but at least it allows easy set City orientation in world coordinates.
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    This is a -GREAT- script, thanks! I ran into an issue though, when I tried to create a height map 2049 pixels in size it crashed the Unity editor. I'm running this on a MacBook Pro Core 2 Duo 2.33 Ghz with 2 GB of RAM, do you suppose I ran out of memory? This script does a very nice job, I just wish it could handle a higher resolution height map.
     
  4. ejtriple

    ejtriple

    Joined:
    Nov 18, 2010
    Posts:
    7
    Does this require sketch up Pro?
     
  5. 3dManMonkey

    3dManMonkey

    Joined:
    Oct 5, 2011
    Posts:
    5
    I am using the conform terrain script to model real world locations, and it is working, however on the edges of the unity terrain mesh the last row of verts doesn't get conformed properly and also the mesh gets heavily tesselated unnecessarily on those same edges. Attached is a pic of the problem. Any help/tips are appreciated. Thanks.
     

    Attached Files:

  6. mutazalhawash

    mutazalhawash

    Joined:
    Oct 18, 2012
    Posts:
    21
    Hey , I am working on a car racing game as a graduation project for my university. I tried to create terrain using sketch up pro and importing the 3ds object into unity but unfortunately the script didn't work with me and i can't find and fix the problem,
    it would be great from you if you help out from this situation
    Regards
    Hawash
     
  7. br0kenp0ly

    br0kenp0ly

    Joined:
    Jun 3, 2008
    Posts:
    481
    This does indeed sound like a superb script! Unfortunately, the link is dead now, so do you guys know where I can find the script or something similar?

    All the best,

    Roald
     
  8. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    Yes, An updated link would make us glad.
     
    JamesArndt likes this.