Hi there,
I am trying to dynamically create a navmesh by a script, I have a plane which is created dynamically and it’s position is constantly updated. I add the navMeshSurface component and build the navMesh, however it’s empty. Looking through it using the NavMeshTriangulations I see the vertices and triangles are 0. The dynamically created object has a plane mesh (mesh filter) and that mesh has real values for vertices and triangles, when this plane mesh is used to generate a navmesh it doesn’t work as I get 0 triangles and vertices. Note the dynamically created object has a scale of less than 0, Does this affect it?
Did you solve the problem with ARKit and Surfaces Baking. Right now I’m having a similar problem. I can bake the surface but and extra surface is generated over the one I need. I don’t know why. I just posted this question
Hey i didn’t really get that problem but i got this reply for my issue ps the mesh was too small as the generate planes script created a small plane… https://github.com/Unity-Technologies/NavMeshComponents/issues/47#issuecomment-350319163
I looked at your question and i’m not sure why that happens, how are you baking the mesh? I did it dynamically and set the mesh vertices and triangles to be the size of the object i wanted the mesh on so for you i recommend you create the navemesh dynamically.
- Create a navmesh dynamically on your cube
- Instantiate a new empty object dynamically called newNavMesh add a mesh to it and set this mesh to have the mesh created by the navmesh on your cube.
- Add a navmesh surface component on this newNavMesh object and then call the function to create the navmesh it should create the blue navmesh based on the new mesh you have created.
- Set this to be the position of the cube
- delete the navmesh on your cube as the newNavMesh object has navmesh surface
I did this and it basically copys the mesh from the navmesh surface on a new object and makes this new object will handle your navmesh