Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Pathfinding on procedural meshes?

Discussion in 'Scripting' started by EBR, Jul 15, 2014.

  1. EBR

    EBR

    Joined:
    Jan 27, 2013
    Posts:
    117
    I was wondering what the best way to do this was. Should I use a node based system using the meshes vertices? The mesh is supposed to be a cave and I am trying to add spiders. Which method of pathfinding is the quickest?
     
  2. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    I swear Unity's build in NavMesh can rebuild at runtime, but I am not 100% sure. I do know that this can be rebuilt at runtime for pathfinding...

    http://arongranberg.com/astar/
     
  3. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    680
    Unity's navmesh is baked, and cant be created or modified at runtime. Aron's aStar can do runtime scans, but it also has optimized methods to modify only specific areas of the graphs.
     
  4. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Thanks, I could of sworn it could rebake at runtime.
     
  5. EBR

    EBR

    Joined:
    Jan 27, 2013
    Posts:
    117
    At the moment it is baked but I saw in the unity 5 update list it said something about navmesh updates.
    Thanks, I have briefly glanced at Arons A* and I couldn't find any 3D pathfinding. And on top of that I was planning on writing it myself . A node based system seems the best way to go so far.
     
  6. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Ah maybe that's what I was thinking of.
     
  7. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    680
    3d pathfinding can be done with arons a* either using point graph or layered grid graph. Point graph is probably same what you are planning to do. Layered grid is pro stuff, and no idea how it works. Most of the stuff works out of the box with arons a* and it really does the job, and its incredibly fast, but if you want more control, its pain in the ass (poor / deprecated docs, complex code).