Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Looking for script to flatten ground

Discussion in 'Scripting' started by jf3000, Jun 14, 2022.

  1. jf3000

    jf3000

    Joined:
    Dec 31, 2013
    Posts:
    166
    I am looking for a script that will flatten the ground when the object is placed on the ground. If you know of a paid or free script, please let me know.

    Thank you.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    It's far from an editor, but this contains not only pseudo-fractal mountain-making, but it lops off flat spots on them, even does the alpha splatmapping so the texture is different on the flattish part.

    You should be able to rip out the relevant computations from worldspace to heightmap space.

    See the line where it instances the TerrainData, which you probably want to comment out so that you are intentionally modifying on disk data, or else you would need to write an editor script to write the instanced and modified TerrainData back out.
     

    Attached Files:

    jf3000 likes this.
  3. jf3000

    jf3000

    Joined:
    Dec 31, 2013
    Posts:
    166
    I will check it out, thank you.