Search Unity

NavMesh- Build navmesh not just for local up but multiple other directions realtime.

Discussion in 'Navigation' started by Ardinius, Aug 14, 2018.

  1. Ardinius

    Ardinius

    Joined:
    Oct 4, 2015
    Posts:
    57
    Hi,
    I have a navMesh for a procedural scene using localNavMeshBuilder, but am attemping to add navMesh data for the verticle sides of the walls, in order to allow spiders to walk up the walls (see screenshot example).
    spider nav.JPG


    As i understand by default the LocalNavMeshBuilder will build the navMesh for the local up direction.

    So my current solution is to have 4 NavMeshSurfaces, each on a GO with the correct rotation (vectors forward, back, left and right).
    Whilst this works, it leaves me with the issue of having to procedurally connect the 5 different navMeshes (up,forward,back,left,right) with NavMeshLinks.

    Is there a smarter way todo this?
    • Can you merge NavMeshData from multiple NavMeshSurfaces into a single entity?
    I know you can grab the navmesh vertices/triangles through NavMesh.CalculateTriangulation(), could you grab multiple NavMesh and use NavMesh.AddNavMeshData() to have a single mesh?

    • Can a NavMeshSurface bake for more then a single direction vector?

    I see you can override the direction that LocalNavMeshBuilder builds with via
    m_NavMesh.rotation = Quaternion.AngleAxis(41, Vector3.forward);
    Can you overload it so it builds with a rotation, then builds with another rotation and keeps data for both so you have navMesh data for more then a single rotation?

    If this can't be done in anyway, i guess i will resort to procedraully placing NavMeshLinks perhaps with the help of NavMesh.CalculateTriangulation()

    thanks all for your time and thoughts,
    regards
     
  2. adriant

    adriant

    Unity Technologies

    Joined:
    Nov 1, 2016
    Posts:
    69
    Hi,
    No, multiple NavMeshData cannot be merged together. They can only be connected through links in order for a NavMeshAgent to be able to move from one to another.

    No, the NavMeshSurface can bake for only one orientation. If you bake multiple surfaces for multiple orientations then you would need to connect them with links.

    NavMesh.CalculateTriangulation() only exports a copy of the NavMesh triangles. Having that information could potentially help you to procedurally find the places where the links need to be placed.