Search Unity

NavMesh Extension (NavMesh Drawing & Portals)

Discussion in 'Assets and Asset Store' started by Baroni, Apr 12, 2014.

  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    THIS ASSET IS DEPRECATED

    NavMesh Extension
    extends Unity’s navigation system by an editor UI for drawing NavMeshes, in addition to portals (teleporters), which intelligently search for shortcuts similar to off-mesh links. Does not require Unity Pro.

    Ever wanted to create custom NavMeshes, instead of marking whole objects as static? Then this is for you! Our editor scripts allow you to place vertices on colliders in your scene, to build tailored meshes for use with Unity’s navigation and pathfinding system. You are able to bake your NavMesh based on these meshes to let Unity’s NavMesh agents walk on them. Additionally, NavMesh Extension comes with support for portals, which can be placed anywhere on a NavMesh. Portals work like teleporters and can produce shortcuts or connect non-continuous NavMeshes, such as islands, for that little bit of extra polish in your navigation logic.

    Features:
    • Complements Unity's pathfinding system
    • Place vertices to create NavMeshes for agents
    • Select and move multiple vertices at once
    • Save your meshes as assets and prefabs
    • Place portals to allow for shortcuts or islands
    • Find the shortest path through multiple portals

    Docs:



     
    Last edited: Apr 21, 2019
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Updated with new info, submitted to the Unity Asset Store.
     
    Taloose likes this.
  3. maidamedia

    maidamedia

    Joined:
    Nov 19, 2009
    Posts:
    224
    I m going to buy it after easter! I always asked for a tool like this, instead of long calculations this is the fastest solution. Very simple nav mesh creation!
     
  4. Whiskan

    Whiskan

    Joined:
    Apr 13, 2014
    Posts:
    4
    Would this be compatible with assets such as "AI For Mecanim" or UFPS AI? This seems like a powerful tool, but I'm not looking to bug up my work with something new and uncommented on. I would likeley purchase this if others provide feedback and I my above question is answered :D

    Thanks!
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    You guys beat me to it, NavMesh Extension is available out now!

    @maidamedia
    Thanks for your support, I'm glad to hear that you've waited for our asset :)

    @Whiskan
    Thanks for asking! I can't see a reason why NavMesh Extension would not work with AI For Mecanim. The drawing part in NavMesh Extension lets you create a mesh, ready to bake with Unity's NavMesh system. AI For Mecanim uses Unity's NavMesh agents (as far as I can tell), so they both build upon the same system. Our portal manager is an optional component and works with agents.

    UFPS AI comes with its own pathfinding solution (A* Pathfinding Project, correct me if I'm wrong) and does not use Unity's NavMesh system, which means that our portal manager won't work in this case. If the A* Pathfinding Project is able to create a navigation grid from meshes, then our drawing part would work too.

    As for "new and uncommented", we are developing Unity assets since a few years and are more than happy to improve them based on user feedback. We've received a lot of feedback for our other products (see my signature) and are always making sure that they work as expected.
     
  6. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,054
    really nice tool! :)
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks, nice to see you around :)
     
  8. Abdulgader

    Abdulgader

    Joined:
    Feb 13, 2014
    Posts:
    6
    Hey Baroni,

    I have bought the extension. But it seems like it doesn't work with 2D right?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
  10. Abdulgader

    Abdulgader

    Joined:
    Feb 13, 2014
    Posts:
    6
    Thanks Baroni,

    Guess i'm stuck for now then.
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    You could still use a top-down camera (x-z axis) as a workaround when working on pathfinding with Unity's navmesh. But that would mean to rotate all sprites by 90 degrees and using 3D physics.
     
  12. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    hi i'm interested

    i'm have / i'm using unity free (not pro) and a* pathfinding project
    http://arongranberg.com/astar/

    i have procedurally generated world made of tiles each tile is loaded and unloaded as needed as the players moves from tile to tile.

    each tile has its own generated navigation mesh that works great. the thing is i dont have a way for npc to go from the mesh on one of the tiles to the mesh on another of the tiles as the players move from tile to tile. so they sort of go to edge of the tile and then sort of stop since there isn't a path

    so basically the npc presently can navigate within a tile but i cannot get them to navigate from one tile to the other at present since each tile has it own pregenerated navigation grid

    looking at your demo and video i was thinking perhaps i could use something like bridges from your asset to overcome this limitation.

    it would all have to be pre generated but the which tile will be next to which tile wont be known until the world is generated at runtime.

    so the bridge when its pregenerated is to nowhere since it which tiles will be adjacent is not known until after the map is generated and actually its not really adjacent until the tiles are paged in as the player walks around and is either on the tile or a tile that is directly adjacent to the tile that they are on.

    so its sort of the player starts the game generates a world or uses one that they previously generated.

    world generation involves like picking how many tiles by how many tiles (x/y) and it goes off and randomly picks the tiles and spawns the player on one of them

    so could i generate a mesh on tile 1 lets say and a mesh on tile 2 lets say and put some bridge on all sides of each tile hat is not connected to the other tile until runtime and the npc from one would be able to during runtime move from tile to tile following the player?

    thanks in advance!
     
    Last edited: Apr 17, 2014
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi there,

    thanks for your detailed explanation. Do you use Unity's navmesh for navigation or something else? As far as I am aware, there is no way to bake Unity's navmesh at runtime, so you should be using something else here? Our mesh drawer is for the editor, but you could save editor-created meshes as prefabs and load them in at runtime. Our portal manager (movement through portals) only supports Unity's navmesh system though.

    Edit:
    Ah, makes sense now. I'm afraid our portals wouldn't help you in this case.
     
    Last edited: Apr 17, 2014
  14. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    ive tried both unity navmesh and a* pathfinding project

    im not looking for a portal as much as a bridge..

    looks like i will have to program one myself

    actually the meshes i used are prebaked (pre generated)

    i dont generate them at runtime at all

    i load them with the tile as needed

    the thing is when i come to the edge of one tile navmesh and i want my character to sort of start on the other tile navmesh i need a bridge i saw your bridge and i was thinking perhaps that would work. i could put a bridge. but that bridge would have to be done at runtime between adjacent tile navmeshes at runtime...

    its a programming problem... i perhaps could do it. but honestly ive been buying my way out of doing things as much as i could. since i have lots to do that i cant find buy...

    it would have been one less thing that i would have to do...

    anyways best of luck. perhaps u would add such support to unity navmesh in future... also think of adding realtime changes like when scene changes during runtime and navmesh has to be updated during runtime. stuff that is in pro, but not in free. have a unity indie way of doing it. also it looks like what i want to do also unity pro has suport for, but not free :(
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Actually that isn't in the free or pro version... unfortunately Unity's navmesh system is deeply integrated and very little is accessible to developers. Realtime re-baking or other features (2D navmeshes) would be awesome indeed, but that's a thing Unity should ship in its core. I know that Aron's A* project allows for realtime re-baking, so maybe your "bridge" should be possible with that... good luck to you too!
     
  16. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    thanks for your response to my posts and best of luck with your very nice assets!
     
  17. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    I use large 2000 by 2000 terrains and the unity navmesh which works. But:

    I have buildings in the terrain, towns and villages which have doorways and I want my AI to go inside buildings. So I have to set my resolution high: roughly my radius to 0.5 and my AI to be 1 wide = 2m doorway (which is twice as big as real life).

    Most of the terrain is mountains and hills and does not need to be such high resolution.

    I am pushing the limit of the unity navmesh because I hit the 6,000 triangle limit sometimes.
    So the size of my doorway limits the maximum terrain size. If I want a 4,000 by 4,000 terrain I will have to make the doorways 4 metres wide.

    My questions:
    In your example video you're using flat surfaces and I'm guessing that manually drawing the navmesh over a large none flat terrain would be a long and tedious task? unless it can snap to the ground?

    Is there any way I could use unity navmesh for the terrain and your extension for the buildings?
    I have unity pro so have access to off mesh links and navmesh layers

    Do you understand my problem?
    Do you think your asset can help me?
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi nomax5,

    Mesh points do snap to the ground (better, colliders), but it will still be a more or less flat mesh. It's not designed for non-flat surfaces, normally Unity does a better job on them.

    Yes, you could bake the terrain and the meshes created with NavMesh Extension together. Just mark your terrain as static and the buildings as non-static, then draw the additional meshes for your buildings with our asset. That won't require using navmesh layers.
     
  19. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi,

    I want to ask, can i save multiple navmesh prefabs and load at runtime for them to combine for use?
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi there,

    Unity does not support baking navmeshes at runtime.
     
  21. prg1

    prg1

    Joined:
    Oct 4, 2012
    Posts:
    9
    i can load multiple navmesh at runtime ?
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Unfortunately not - Unity does not provide any runtime API for their NavMesh system.
     
  23. prg1

    prg1

    Joined:
    Oct 4, 2012
    Posts:
    9
    but why save it as a prefab ?
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    So that you don't have to draw one shape over and over again. Imagine creating the same rectangle 400 times... otherwise this would be very time consuming.
     
  25. prg1

    prg1

    Joined:
    Oct 4, 2012
    Posts:
    9
    well if i create navmesh with this tool ,can i use api navmesh unity
     
    Last edited: Jun 19, 2014
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
  27. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    Hi RG,

    i would love to get this, but i need to know whether its possible...

    since unity cannot bake navmesh for travelling under bridge (navmesh built on a bridge but cuts off for the under bridge), is yours possible to build? (A)

    on your docs stated that, meshes created can be saved as asset/prefabs, can the navmesh + bridge = prefab? (B)

    image posted for better understanding...
    qn.jpg
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi OP3NGL,

    that's a yes to both of your questions. You can draw your mesh wherever you want it to be, which means that you can draw one above the bridge and one below (A). Remember that you aren't drawing the navmesh directly, you are just drawing a custom mesh for use with Unity's NavMesh system. You can also save the mesh you've drawn and the bridge together as a prefab (B).
     
  29. wallen

    wallen

    Joined:
    Jul 29, 2010
    Posts:
    14
    Nice tool ! But if 60 portals,shortest path finding very slow
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks! 60 portals are a lot, as the path calculation has to go through each of them recursively to find the shortest path. With that many portals, I would recommend excluding some portals which do not make sense to consider, or even creating a new sub scene.
     
  31. RockenX

    RockenX

    Joined:
    Oct 17, 2012
    Posts:
    14
    Hi I'm looking at your nav mesh and I have a questions. How well does multiple objects, let say 100, using the navemesh works? Do you know how much CPU process it uses?
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Unity's pathfinding system is very optimized and easily handles hundreds of agents (it is included in the free version since Unity 4.2, you can try this by yourself).
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Version 1.1 is live:

    - Added option to delete selected vertices: select vertices
    when not in Edit Mode, then press backspace to delete them
    - Revisited Undo/Redo: undo/redo will not leave the Edit Mode
    by default and behave as expected when editing meshes
    - Fixed mesh calculation for reflexive/closed submeshes
    - Added more links to the NavMesh Extension > About window

    Undo/Redo should be more robust now and can even be used when in Edit Mode. Also, deleting selected vertices will rebuild the submesh based on remaining vertices.
     
  34. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    deletion of 1 vertics will screw up the whole navmesh
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    I'm not able to help you with that description. Please provide repro steps and screenshots in a new project, also have you tried entering and leaving the edit mode again.
     
  36. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    1. I manually create 4-vertex cells.
    2. I join the other cells through their adjacent vertexes.
    3. The navmesh material was assigned so it appears to be working as normal.
    4. However, when a vertex is removed, the mesh created will become deformed. Most, if not all, of the cells will no longer retain their intended shape and instead, join with other vertexes from various part of the map.
    5. Though the positions of the vertex remains undisturbed, the mesh it created is broken.
     
  37. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    855
    Can you draw navmeshes on walls and ceilings?
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    @OP3NGL
    Thanks for the explanation, could you please post screenshots (before / after) too? Has entering and leaving the edit mode changed anything?

    @thelebaron
    You could, but Unity's NavMesh agents are always oriented on the x-z axis (face up), so it probably won't work as you desire.
     
  39. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    Baroni, does the NavMesh Extension support importing a custom mesh instead of creating it inside unity?
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Yes, importing your own mesh (and checking navigation static) would be the normal way of doing it. All meshes, imported or created with NavMesh Extension, will then bake the NavMesh geometry.
     
  41. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    Thanks!
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Critical fixes for those having issues with locked scene view cameras:

    Version 1.1.2
    - moved control info box to the scene view
    - fixed issue where scene view cam gets locked (explicitly disabling view controls due to Unity bug)
    - fixed not adding new vertices with alt key pressed

    Get it here.
     
  43. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    205
    Hi,

    Superb Asset!

    Can you make a demo that works with Sample Assets Beta AI Character script.

    Thanks
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi Max and thanks, could you explain what's not working with it?
     
  45. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    205
    Sorry everything is working fine with your asset, I would just like to be able to compare them. I am a Playmaker user so I like to be able to access the target as a public var. I can just put my FSM's on the target prefab, for this project it is probably the best solution.

    Thanks
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Free asset giveaway!

    Starting next month, we will be giving away this or one of our other assets (http://u3d.as/2uX) to one lucky follower every month. Follow us on Twitter @Rebound_G to stay updated and don't miss the chance to win!
     
  47. jimboyte

    jimboyte

    Joined:
    Feb 25, 2013
    Posts:
    23
    When I upgraded to Unity 5 I seem to have run into a little BUG I am hoping you can help with ... THANKS!

    Assets/NavMeshExtension/Scripts/Editor/NavMeshManagerEditor.cs(75,35): warning CS0618: `UnityEngine.Renderer.castShadows' is obsolete: `Property castShadows has been deprecated. Use shadowCastingMode instead.'

    MeshRenderermRenderer = navGO.GetComponent<MeshRenderer>();
    mRenderer.castShadows = false;
    mRenderer.receiveShadows = false;

    I have been trying to figure out how to use some form of ... .shadowCastingMode = ShadowCastingMode.Off;
    But so far I have not been able to figure it out. PLEASE HELP! THANKS!
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi jimboyte, this is a warning, not an error. Your app/project will run just fine without changing anything. If you really want to get rid of the warning, this is the line in question:
    Code (csharp):
    1. mRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
     
    jimboyte likes this.
  49. jimboyte

    jimboyte

    Joined:
    Feb 25, 2013
    Posts:
    23
    Thank you! Perfect!
     
  50. nogaskater

    nogaskater

    Joined:
    Apr 25, 2015
    Posts:
    5
    Hi Baroni,

    I'm trying to bake the NavMesh I just created with the button Bake NavMesh at NavMesh Manager, but it just bakes all the terrain. What am I doing wrong?