Search Unity

NavMesh Surface in ARKit

Discussion in 'AR' started by dav10001, Nov 1, 2017.

  1. dav10001

    dav10001

    Joined:
    Nov 30, 2015
    Posts:
    10
    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?
     
    ina likes this.
  2. tonOnWu

    tonOnWu

    Joined:
    Jun 23, 2017
    Posts:
    83
    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
     
  3. dav10001

    dav10001

    Joined:
    Nov 30, 2015
    Posts:
    10
    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.

    1. Create a navmesh dynamically on your cube
    2. 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.
    3. 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.
    4. Set this to be the position of the cube
    5. 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
     
    tonOnWu likes this.