Search Unity

Manipulating terrain in-game

Discussion in 'Scripting' started by unikum, Oct 14, 2009.

  1. unikum

    unikum

    Joined:
    Oct 14, 2009
    Posts:
    58
    Hello,

    Is it possible to manipulate the terrain in-game?

    For example, lowering the closest terrain node (not sure if that is the correct term) to the player when he press a button. Been looking through the documentation but can't figure out if this is possible or not.

    Anyone know how/if this can be done?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you would alter the heightmap of the terrain
     
  3. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Yes. You can use GetHeights and SetHeights to do this.
     
  4. unikum

    unikum

    Joined:
    Oct 14, 2009
    Posts:
    58
    Thanks guys

    I figured it was with those functions but couldn't get them to work at first, but I found an old forum post about it and also realized that I had to divide my player's position down to the heightmap size (that was smaller than the world size). Works great now!