Search Unity

NavMesh being cut stops agents

Discussion in 'Navigation' started by RocketWerkzStudios, Jul 22, 2015.

  1. RocketWerkzStudios

    RocketWerkzStudios

    Joined:
    Jul 22, 2015
    Posts:
    3
    When our path gets cut, all our agents pathing through the cut point pause until the path is no longer cut. They do this regardless of whether the agents have got to the node where the path is cut or not. Is there any way I can have the agents keep pathing even if some part of the future path is cut?
     
  2. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Have you tried adding a check if they are stationary and if they have reached their target yet? You could set the destination again if they have been stationary for X amount of time and that should calculate another path I think (there may also be a more direct access to call a path recalculation, check the docs, I'm not sure). You probably don't want them to recalc the path the exact moment it gets blocked because there might be temporary obstacles that will disappear again soon and going on another path right away would be a suboptimal solution in that case. It depends a bit on the circumstances that your agents can get exposed to.

    Disclaimer: I have neither tested this nor do I have the experience to recognize if the way I suggested is a bad hack.
     
  3. RocketWerkzStudios

    RocketWerkzStudios

    Joined:
    Jul 22, 2015
    Posts:
    3
    Hi Martin - thanks for the reply. I can get a path and continue moving eventually. What I want the agent to do is to not stop moving in the meantime - there is absolutely no reason to do so. If I have a path of 10 nodes and the 9-10 arc is blocked, I should be able to keep pathing the 1-9 arcs without any pause (especially with my case - pedestrians walking a long distance with a path being cut by a car momentarily going over a crossing point in the distance).
     
  4. RocketWerkzStudios

    RocketWerkzStudios

    Joined:
    Jul 22, 2015
    Posts:
    3
    What I think would work is if when the path was broken, there was some way of retrieving which arc of the path was broken. That way we could cache the original path and then just repath to the node prior to the break - that would keep our agent moving and in most cases when we got to the break point (traffic, in our case) either the way would be clear or we'd be having to wait there anyway.