Search Unity

[Solved]Advanced vector math problem - manipulate (vector)path to match a set of edges

Discussion in 'Navigation' started by PhilippG, Sep 27, 2015.

  1. PhilippG

    PhilippG

    Joined:
    Jan 7, 2014
    Posts:
    257
    Hello!
    I'm currently working on a pretty special navigation related system, its basically sort of a queueing mechanism for nav agents traversing narrow hallways. I need full code control so behavior like have them push each other around priority based is not an option.

    Heres the situation for a single agent (blue) and its destination (red):
    1.jpg
    I can now find a valid path to the destination, a set of vectors for traversal:
    2.jpg
    Now this path is obviously not authored and won't respect the rules I need to establish.
    So, the System I have designed is basically a Point/Edge-based network sitting somewhere on the navmesh:
    3.jpg
    What I now need to do is to go iterate the set of vectors to find a matching set of edges and directions. Additionally, at some point, I'm gonna leave the hallways so I do also have to detect when the default navigation kicks in:
    4.jpg
    So what do you think, what would be the best way to do this? I also need to keep an eye on performance, it is very likely that theres a high count of agents in scene.

    Thanks in advance,
    Philipp
     
  2. PhilippG

    PhilippG

    Joined:
    Jan 7, 2014
    Posts:
    257
    I solved this by defining seperate areas for navigation with/without edges. Navlinks between these areas have a reference to the set of edges in the connected areas. I can now traverse and break the path accordingly.

    I'm currently using the A*Pathfinding project but I'm pretty sure the same approach works for the built in solution.