Search Unity

Random shaped hole in 2D array map

Discussion in '2D' started by DJVDJV, May 7, 2019.

  1. DJVDJV

    DJVDJV

    Joined:
    Sep 11, 2014
    Posts:
    70
    Hi,
    I have the map as 2D array
    that have axis x and y.

    Let say I take part of the map (Square)
    Like:
    Bottom left corner: x = 10, y=10
    Top left corner: x = 10, y=90
    Bottom right corner: x = 150, y=10
    Top right corner: x = 150, y=90

    Now I want cut "random shaped" hole on it like:
    upload_2019-5-7_17-25-44.png

    Where the black is 1
    And white is 0

    What is the best way to cut this kind of random hole?
    I checked noise algorithms etc. but there was not an easy nice way to do this.

    Any ide how to make this easy and essential way?