Search Unity

Get the farthest pathFindable point from center ?

Discussion in 'Navigation' started by Wonsder, May 12, 2020.

  1. Wonsder

    Wonsder

    Joined:
    Jan 24, 2020
    Posts:
    37
    Hello !

    I am quite new to unity pathfinding system, and I would know if there was a method to get the furthest point from a center position, that is still reachable for a nav mesh agent.

    I can loop trought the points (easy to implement in my code), but is there a way to "measure" the distance of the path ?

    Thanks for reading, and for help !
     
  2. Whipexx_DigitalSun

    Whipexx_DigitalSun

    Joined:
    Aug 8, 2017
    Posts:
    18
    If you mean having a few points and selecting the one that is furthest but still reachable, yes. You can calculate the path towards all of them, get the ones that give you a complete path and select the one that has the longest path (calculated by adding the distances between corners).
     
  3. Wonsder

    Wonsder

    Joined:
    Jan 24, 2020
    Posts:
    37
    I've manage to do it, Thanks !
    Yes, I a calculating all paths, and getting the position of the corners, I add all the corner-to-corner distances.