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

Navigate as close as possible to unwalkable area

Discussion in 'Navigation' started by Haedrian, Jul 9, 2018.

  1. Haedrian

    Haedrian

    Joined:
    May 4, 2014
    Posts:
    4
    I'm making a simulation game, which has a number of agents which run around and do tasks.

    One of the tasks is cutting of trees - which is performed by walking up to a tree and then cutting it down.

    I navigate using a NavMesh, and right now I have a NavMeshVolume which marks the tree as a high-weight area - I'd like to change this to make the area unwalkable.

    The problem I have is when I mark trees as unwalkable. I don't want my agents walking through trees, however, if I set it up like so, then whenever I SetTargetDestination to the tree - I always get an invalid path.

    Is there some way of getting agents to pathfind as close as possible to an item?