Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

NavMesh.CalculatePath Produces Paths through Air

Discussion in 'Navigation' started by Glader, Oct 15, 2019.

  1. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    401
    I don't often use Unity3D's navmesh system but I now have a need for pathfinding without agents. Paths generated from NavMesh.CalculatePath do not seem to be aligned to the navmesh and sometimes go straight through the air. Am I doing something wrong?



     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    381
    Might be something in your agent settings, Navmesh itself seems pretty fine.
     
  3. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    401
    Are agent settings used when no agent exists? I'm not using any agents. I generate a point path from CalculatePath and then I make the entity walk the path by hand without any navmesh agents.
     
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    381
    Yeah, Agents are still used when calculating the path, since Agent Settings contain values such as their radius which might prohibit them from walking through narrow corridors and such.
     
    Glader likes this.
  5. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    401
    Hmmmm, I didn't know that. I think I use the default settings for agents which would surprise me if this setting would generate paths through the air. Does anything look out of the ordinary to you here in this picture?

     
  6. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    381
    No, that looks pretty normal to me. Do these measurements make sense for your character?
     
  7. canis

    canis

    Joined:
    Oct 25, 2013
    Posts:
    65
    did you do it on awake()?
    I also have this issue, however run the API again e.g. after start() will give me the correct result.
     
  8. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    401
    Unfortunately this isn't around the time of startup, I still haven't found the source of this issue yet. Seems very strange a path generated from the navmesh wouldn't align with it.
     
  9. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    401
    Still experiencing this issue.
     
  10. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    161
    Could you post your code of displaying the navmesh path? Because if you do not have a change of direction, you would get something like this. Do the navmesh agent walk through the air as well or is it just your navmesh path debug view?