Hello! I’m trying to make a tree growing system similar to Lumber Tycoon 2’s. To encourage variation in the trees, I’m trying to make the minimum degrees between two branches 20 degrees. I’ve done a good bit of googling but haven’t found any solutions which have worked. I’m terrible at explaining things, so I’ll try to explain in pictures below:
This tree looks pretty good and is what I am aiming for. There’s enough distance between the base of each branch.
This one is pretty bunched up and doesn’t look that great.
And then this one is absolutely terrible.
This is the code to find the degrees between the two Vector3s. These are esentially the orientation of the branch:
function angleBetweenVectors(u: Vector3, v: Vector3)
return math.deg(math.acos((u:Dot(v) / u.Magnitude) * v.Magnitude));
end
I really am not sure if this is a coding question or a logic question or something else entirely, but this is what I’ve been spending the past two days trying to fix. If you have any ideas please let me know, they’re greatly appreciated.