- Home /
Does anyone have any experience scripting trees onto a heightmap?
I have looked around this site as well as others to see if this is possible in Unity, but most places I have seen simply refer to manually placing the trees through the tree editor. What I wanted to do was place trees on a heightmap placed on a terrain given a set of (x,y,z) coordinates. I assume this is possible, but I have not seen anything to suggest that it can be done in Unity. Has anyone done something similar or suggest a starting point?
Well, if you can add trees during runtime and just need the xyz vector, then generate a random xz position, cast a ray downward, and use the hit.point as the vector.
Answer by FortisVenaliter · Jun 08, 2016 at 07:37 PM
You need to add TreeInstances to the TerrainData of the terrain. See here for the docs on that.
Thank you, I have been messing with it for the past day, and it seems like a good place to start
Your answer
