So, I’ve made quite a few prefabs of trees and vegetation for my game and now its time to actually place them on the terrain in large quantities. The prefabs I’ve made aren’t anything like the unity trees and vegetation, so I’ve been unable to use the default terrain tree paintbrush with them. My question is, what would be the best way to place these custom gameObjects on the terrain so that they line up to the ground and can be painted on easily. What would be the most efficient way to solve this problem?
If you mean what I think you mean,you want Detail painting.
First thing first,if you modeled the asset yourself,make sure the Y axis is up,since Unity follows Y as up.
Then drag your mesh onto the scene and texture it.
Then just create a prefab of what you want in assets and drag the mesh/object you have on scene onto the prefab.
Next click terrain,go to Detail Objects,and select the prefab.
Adjust the settings to your liking,same with how much you place,the brush,etc…
Then click on the terrain to paint that object!
PS - I’ve not yet sure how to use physics on a detail object,but i’m pretty sure all you do is have the Collider you want in the prefab,and it’ll work.
I have an idea on how to get them placed correctly, but not how to paint them. Basically create an empty game object and set it as the parent of each different tree prefab at the location of where you want the tree to clip the terrain.
Then use code to check the terrain height at the location you want to place the tree/s at, then set the position of the empty game object to the terrain height, since it is the parent this will move the tree into position nicely.
You can try my asset MeshBrush on the store, it does exactly what you are looking for: Unity Asset Store - The Best Assets for Game Making