- Home /
How can you access the Navigation Mesh Data ?
What I am trying to do is simply export the navmesh generated by unity as an .obj file so I can edit it in 3ds max. Is there any way of accessing that kind of data ? It would be very helpful in so many regards.
Thanks for any answers
the word seems to be that you can NOT access the navmesh info.
(indeed, who knows if it is tris, like a normal mesh, or something else?)
indeed, as I understand it furthermore, quite simply you can't build navmesh at runtime - only in the editor.
have you solove the problem, i have the same problem...can you tell me how to export the vertices to Navmesh, Thank you very much!!
Answer by Matou · Mar 21, 2014 at 04:09 PM
Perhaps this is a bit late, but maybe this will help people hoping for an answer... I achieved to convert the navmesh to a Mesh object by using the following code:
NavMeshTriangulation triangles = NavMesh.CalculateTriangulation();
Mesh mesh = new Mesh();
mesh.vertices = triangles.vertices;
mesh.triangles = triangles.indices;
Then maybe you can dump the Mesh in OBJ using AssetDatabase.CreateAsset(...) and AssetDatabase.SaveAssets(); or else you can use some OBJ exporter like this one: http://wiki.unity3d.com/index.php?title=ObjExporter
However I must say the documentation about NavMesh.CalculateTriangulation() is a bit poor ... It usually (but not always) worked for me until now. I can't assure you the model will be perfect. But if you expect to modify it with 3D MAX, you may spot eventual problems.
If anybody knows more about this CalculateTriangulation function, his/her opinion is more than welcome :)
Hope this helps! Cheers.
Answer by paulsz · Oct 08, 2012 at 02:03 PM
Yes, it seems that you cannot acces the mesh data generated in the editor. My plan was to use that data to build in 3ds max a new mesh that is more similar to the nav mesh. I guess I have to do it manually :) I'm sure there could be a way to access it if we had the unity source code and transpose the mesh data into an .obj or something. That type of priviledge seems to be off limits for us, proletariates :(