Randomly place objects USING ALPHA MAP
Hello everybody! Sorry for my bad English, It is not my native=)
I want to randomly place objects USING ALPHA MAP (only black color, not grayscale). The black areas on the map are using to determine where we CAN place an object.
Why do I want to do this? For example, we have some terrain with a river. We want to randomly place a chest on that terrain and the point is we want our chest NOT TO BE IN THE RIVER. We have a special location to place that chest and that location can have a very complex structure.
Of course, we can just take random points with Random.Range() and check each point: "Does the point is on the black area?" BUT if we would have a very small (<10% of total area) and complex "available" area (for example, islands in the swamp) then there will be a very large amount of "garbage" points. Therefore it is very inefficient method.
Does the quick and performance technique exist for such problem?