Hi, I’ve been trying to generate a grid graph in a scene with many trees placed using Unity’s terrain tool, they all have colliders that intersect with the ground and are on the right layer, but the scan doesn’t recognize them as obstacles and ignores them. The scan works fine with objects placed manually though.
I saw someone posted about this problem ~3 years ago here Pathfind around trees , but the only solution proposed was a bit of a hack that will significantly increase the number of objects in my scene. Has anyone found a solution to this problem since then?
Thank you!
Hi
Hm. I thought it worked with the latest version, but it was a long time since I tested it.
If you have a test scene that you could share with me, I could debug it and see why it is not affecting the graph properly. I believe it may have something to do with how the trees are configured.
Hey Aron, thanks for the reply – I’ve been having an issue exporting the scene with the correct dependencies and it’s very time consuming, do you have an e-mail I can send an exported scene with all the dependencies without posting it publicly so I don’t have to worry about accidentally posting my code / other proprietary assets?
Hi
Sorry for the late reply.
You can send me a PM on this forum.
If it is problematic to export just the necessary assets, you can send me the whole project. I have a pretty good internet connection, so even downloading several gigabytes should not be a big problem.
I was unable to send a message directly to you so I replied to the welcome message from halfvoxel with a link to the test scene. Thank you!
Hi
Ok, I got your scene.
However from what I can see you have a grid graph configured, but both the collision testing and height testing masks are set to ‘Nothing’ in which case it will obviously not detect any obstacles at all.
I see there are a bunch of colliders generated by Gaia. I changed those to the TransparentFX layer and set the collision testing mask to use that layer. Then trees are detected:
My mistake with the layers, I had normally set the collision layers to be Tree/FoliageSolid and the height to be Terrain. The problem still is that I want to use the colliders on the tree prefabs, not the colliders that Gaia generates (which is what I believe is pictures in your screenshot).
Ok.
I did some tests and it seems that Unity will only actually generate the colliders during runtime, not when outside of play mode.
Hey,
thanks for the hint that the tree collider are generated at runtime. This helped a lot.