Search Unity

The height of GameObject on navigation mesh

Discussion in 'Navigation' started by magiceye, Mar 10, 2016.

  1. magiceye

    magiceye

    Joined:
    Oct 29, 2014
    Posts:
    9
    A gameobject located in a poly which belong to the navigation mesh. I found when it move on this poly, the height(y) value is changing. However the change is small (< 0.5), but in geometry view, the y value of any point on a poly should be exactly same.

    My question:
    1. Does game object locate on the navigation mesh surface or something else?
    2. The blue surfaces which show the navigation mesh is the real mesh which unity3d use or it just a simplification. If it just a simplification, that can explain the y value changing because gameobject cross triangles which in real mesh. But those triangles not show in UI.
     
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    the blue mesh is called a navmesh, it's always offset about .1 units from the static mesh. If you want your agent to touch the surface, offset its geometry
     
  3. magiceye

    magiceye

    Joined:
    Oct 29, 2014
    Posts:
    9
    The unit indeed locate on navmesh surface, but I found the surface is curved surface. That's why when move in a poly, the unit y axis value is changing even it have not cross poly bounder.

    Curved surface poly in navmesh, is there a way to disable this "advanced feature"? Does it an improvement of original recast which developed by Unity3d?
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    no idea what you're saying, attach a screen capture
     
  5. magiceye

    magiceye

    Joined:
    Oct 29, 2014
    Posts:
    9
    The center of navmesh area is a big poly. But this poly is a curved surface, look one edge we can found the edge is not a straight line. This cause a problem: walk in this poly, the height of walker will change.
    I export unity's navmesh to server, but there is no information about curved surface, so server view this poly as flat surface.

    I think unity make some simplification about this poly, there should have vertex at the turning(red circle in pic), but it not show out also not contained in NavMeshTriangulation structure.

    If I can not get the curved surface info, then I can not make server navmesh data same as client.
     

    Attached Files:

  6. magiceye

    magiceye

    Joined:
    Oct 29, 2014
    Posts:
    9
    Unity can generate height mesh when bake navmesh, but there is no API about it, so no way to export it.
     
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Navmesh always floats above the base mesh.
    If the nevmesh doesn't hug the base mesh enough for you, decrease the error threshold in the advanced settings - not recommended because it makes path search slower.