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 Terrain Deformation during runtime

Discussion in 'Scripting' started by JamieEdwards, Mar 29, 2023.

  1. JamieEdwards

    JamieEdwards

    Joined:
    Sep 17, 2021
    Posts:
    5
    Hi all!

    I'm trying to find out how to make a terrain deformation script which, when the player "activates" the tool and then clicks an area on the terrain, it then increases/decreases that area appropriately.

    However, when trying to find material that does something close to this, it turns out is 6+ years old and uses old code that is now deprecated.

    I know, I need to be using things like
    heightmapResolution()
    instead of
    heightmapWidth()/heightmapHeight()
    for example.

    I would be having a look at some of the assets within the unity store to see how they do this, however I don't have much in terms of money to be able to fork out a purchase.

    As such, I was wondering if anyone knew of any resources that are using the more up to date code which would step me through how to achieve something like terrain deformation, or, point me in the direction to be able to figure it out?
     
  2. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    185
    There may very well be simpler solutions or ready made assets for this. But you may be able to use tesselation or something of the nature. when the player clicks on the terrain, trigger a "painting" of the tesselation map in the area corresponding to the terrain.