Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Welcome! - New NavMesh Features Experimental Preview

Discussion in 'AI & Navigation Previews' started by Jakob_Unity, Nov 1, 2016.

Thread Status:
Not open for further replies.
  1. JesHal

    JesHal

    Joined:
    Jan 22, 2013
    Posts:
    3
    That would be very useful. I'm making a game where I randomly generate dungeon from parts and I need to have multiple agents navigating seamlessly between them. Currently it is not seamless because agents can't use the same NavMeshLinks at the same time.
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    An alternative approach would be to update the navmesh data after adding/removing parts - i.e. having no links for the connections, only regular geometry.

     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,316
    Speaking of link, any plan to do autolinking like the old days? it was very useful.
     
  4. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    No - we plan to do it better :)
    Basically the old auto-offmeshlink generation was very inflexible. You only have two parameters. You cannot tweak the result - e.g. remove or add extra links. We plan to add an annotation tool where you can "paint" the desired seeding of offmeshlinks - ofc. with some presets. It's not yet in development.

     
    laurentlavigne likes this.
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,316
    I'm changing LocalNavmeshBuilder to build for specific agent type but BuildSettings.agentTypeID is an int.

    What's the enum we can use for the inspector's pull down menu?

    I tried a workaround by referencing the agent in the script to extract ID etc... but digging in the NavmeshAgent I don't see .agentTypeID exposed. What's the secret sauce?

    var defaultBuildSettings = NavMesh.GetSettingsByID(agentID);
    then defaultBuildSettings.agentTypeID isn't agentID
    also the shape of the navmesh doesn't match the parameters of the agent. One is lanky the other one is stout.

    Also what is SteeringAgent and .Stop() doesn't stop the agent, I mean it stops the translation movement but it doesn't stop the lookat. What's the magic trick?
     
    Last edited: Nov 25, 2016
  6. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    Any schedule for when this will be added to the 5.5 main branch?
     
    StonePaleAle likes this.
  7. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
  8. kmikkel

    kmikkel

    Joined:
    Dec 16, 2016
    Posts:
    1
    I'd really like to see an option to move the NavMesh so it follows the model/mesh of the objects it is generated from.
    I am using the HoloLens with a big 3D model in 1:1 scale that needs to be aligned to the physical world. So after I alter the gameObject.transform, the model is aligned, but the NavMesh is not moved. It stays in the position it was generated in.
    Any trick I can use to move the NavMesh?
     
  9. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    41
    Looking at the low level documentation, the BuildNavMeshData's "localBounds" parameter is described as:
    "localBounds – ...Empty bounds is treated as no-bounds, that is, the NavMesh will cover all the inputs."

    However, when I create a NavMesh at runtime with this code:

    Code (CSharp):
    1.  
    2. [SIZE=3]public class NavMeshOwner : MonoBehaviour
    3. {
    4.  
    5.     [SerializeField]
    6.     private LayerMask navMeshLayers;
    7.  
    8.     [SerializeField]
    9.     private Vector3 upDirection;
    10.  
    11.     NavMeshDataInstance navMeshDataInstance;
    12.  
    13.     void OnEnable()
    14.     {
    15.         List<NavMeshBuildSource> buildSources = new List<NavMeshBuildSource>();
    16.  
    17.         NavMeshBuilder.CollectSources(transform, navMeshLayers, NavMeshCollectGeometry.RenderMeshes, 0, new List<NavMeshBuildMarkup>(), buildSources);
    18.  
    19.         NavMeshData navData = NavMeshBuilder.BuildNavMeshData(NavMesh.GetSettingsByID(0), buildSources,
    20.                                 new Bounds(Vector3.zero, new Vector3(10000, 10000, 10000)), Vector3.zero,
    21.                                 Quaternion.Euler(upDirection)
    22.                                 );
    23.  
    24.         navMeshDataInstance = NavMesh.AddNavMeshData(navData);
    25.     }
    26.  
    27. }[/SIZE]
    28.  
    A Navmesh is produced fine.

    NavMeshMade.png

    But if I exchange

    Code (CSharp):
    1.  
    2. new Bounds(Vector3.zero, new Vector3(10000, 10000, 10000)), Vector3.zero,
    3.  
    with:

    Code (CSharp):
    1.  
    2. new Bounds(), Vector3.zero,
    3.  
    There is no NavMesh.

    No Nav Mesh.png
    I'm probably making a silly mistake, but I thought that I'd get the same NavMesh, as there were no bound limits (as opposed to very large ones, in my case). Is there a more correct way to create an "empty bounds"?
     
    alexzzzz likes this.
  10. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    I'll have a look - thx for pointing out!

    Please consider picking up 5.6b.
    It contains these navmesh features (only tiny modifications in API).
    The 5.5 based experimental build will receive no further updates
     
    AntonioModer likes this.
Thread Status:
Not open for further replies.