I have a
trees that contains a number of trees I’ve randomly Instantiated into the game. Essentially, I have a function that instantiates
n trees at random locations using a list of prefabs, and once it has instantiated one, it adds it to the list.
However, sometimes you get collisions when two trees are spawned atop one another, and the two trees clip into each other. Is there a way I can check if any two GameObjects in the list of
trees are colliding, so I can regenerate them? I can’t use
IsTouching because it would require n^2 comparisons, which goes into the range of 20000 once I start generating hundreds of trees.