Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NavMesh: Walking on sidewalks, sometimes on roads.

Discussion in 'Navigation' started by Elvis083, Mar 15, 2017.

  1. Elvis083

    Elvis083

    Joined:
    Jan 11, 2015
    Posts:
    26
    Hi!

    I have a city with roads and sidewalks. I want agents to walk randomly on sidewalks, but sometimes make them use also a road (when they want to fight for example). I also want them walk back to sidewalks, when they're pushed to a road by another object.
    I've tried to choose different navigation areas for roads and sidewalks and disable the road mask in NavMeshAgent.areaMask to prevent walking on road, when they go from one target to another (and are not in fight mode). But when they are pushed to a road by another object, they are instantly appearing on the edge of the sidewalk (it's just impossible to push them out of sidewalk).
    Is there some simple solution for such problem?

    Thanks.