I'm re-working a part of my project, and I'm looking for a better way to do a particular task: I have a heatmap, and I need to generate ~10,000 objects and distribute them accordingly. Right now, the order of operations are:
-
- A list of possible positions is generated
-
- A random number is generated to determine which heat zone the object will be placed in
-
- A random position is grabbed from the earlier list, and the heatmap is checked (Raycast) to check if it's the correct zone
- If the zone is incorrect, go back to #3
-
- The terrain is checked (Raycast) for various conditions, such as slope steepness, or if there are any other objects already there.
- If any conditions are met, go back to #3
-
- Go back to #2 and repeat until the required number of objects have been placed