I’m trying to let plants dynamically grow, and one issue I’m running into is making sure they don’t overlap.
The plants are made up of circles that spawn new circles around them every now and then.
What I’m trying to do is, whenever a circle tries to spawn a new circle, it will choose a spot next to it, and check if any circles will overlap with it, by comparing the magnitude of the vector between the chosen spot and the other circle, with the sum of the radii of the circle that is being spawned, and the circle that is being checked.
The problem is, the radii vary between circles, and do not match with the scale in the transform component. (EG a circles with a scale of 1 have a width of about 0.09 in positional units.
So the solution I’m trying to get at, is giving every behaviour script a public variable called radius, and have a circle pull that variable from the script when its checking for overlap.
The problem here is that every circle will have a different behaviour script based on which part of the plant it is (trunk, branch, leaf etc.). This means I do not know the name of the script I’m trying to pull the radius variable from.
Does anyone know a solution to this? Am I even looking at this the right way?
Thanks in advance!