Closed JohnYoung404 closed 8 months ago
I heard previously that it is constructed by extracting using CalculateTriangulation(), but I haven't tried it, so I'm not sure.
To understand the actual data format, it seems challenging as it is hidden.
Here is a sample code:
UnityEditor.AI.NavMeshBuilder.ClearAllNavMeshes();
UnityEditor.AI.NavMeshBuilder.BuildNavMesh();
NavMeshTriangulation navmesh = NavMesh.CalculateTriangulation();
for (int i = 0; i < navmesh.indices.Length; ++i)
{
// ..
}
for (int i = 0; i < navmesh.vertices.Length; ++i)
{
// ..
}
for (int i = 0; i < navmesh.areas.Length; ++i)
{
// ..
}
In this code, it builds the navigation mesh, uses the CalculateTriangulation() method to extract triangulated information, and stores the extracted data in arrays named indices, vertices, and areas.
Thank you for your answer!
I will dive deeper into this issue. My project has just been upgraded to Unity 2022.3, and they have introduced a new navigation system, which seems to be open source. I am not sure if it provides a more convenient way to access navigation mesh data. I will look into it.
Thanks again for your patient responses! :blush:
So I tried to export Unity navigation meshes to Recast navigation, and succeeded:
It's quite a lot of efforts, but it's doable :blush:
wow! good!!
Hey, thank you for integrating Recast Navigation into Unity; I've benefited a lot. I'm also working on server-authoritative pathfinding project, and I feel your work has been very helpful. Thank you!
I have a question, can we use Unity's navigation workflow
unity.ai.navigation
to generate a navmesh and then load it withrecast.detour
?I think Unity's underlying pathfinding is also based on Recast Navigation, and there are some unity-related concepts like NavmeshModifier and Volume, I am more accustomed to this workflow.
This is just my thought. I hope to get your advice. Thanks!