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

Go to point closest to Destination

Discussion in 'Navigation' started by NissStudios, Aug 9, 2018.

  1. NissStudios

    NissStudios

    Joined:
    May 15, 2017
    Posts:
    4
    How can I make an enemy go as close a possible to the destination even if the destination is unreachable?
     
  2. Miggi124

    Miggi124

    Joined:
    Jul 31, 2017
    Posts:
    69
    Hello there!

    As far as I know, if you use a Navmesh and Unity's build in Navigation, your AI will attempt to go as close to the set location as possible, without any extra scripting. It will just travel to the end of the boundaries and stay there...

    Regards,

    Miggi124
     
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    I do a NavMesh.SamplePosition to find the closest point still on the nav mesh using.
     
    leftshoe18 likes this.