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

Waypoint out of range

Discussion in 'Navigation' started by JorgeLogan, Feb 5, 2019.

  1. JorgeLogan

    JorgeLogan

    Joined:
    Jun 24, 2018
    Posts:
    1
    Hi people!
    Well, i have a little trouble...
    I have a script that generate random waypoints, and i want to know how i can tell to the script with the nav mesh agent, if the point generated it´s reacheable or it´s impossible to go (imagine that the waypoint its in the air, out of the hill where the character is)
    Thanks!!!
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    You can use Navmesh.SamplePosition with your generated point. This method will look for the closest point on the NavMesh from your generated point, within a set range. If no point is found, then it returns false and you know your generated point is way off.
     
  3. LegendaryLuke

    LegendaryLuke

    Joined:
    Dec 20, 2018
    Posts:
    1
    can anyone help me please because I have been trying to create waypoints so that my platforms can move along the paths that I want the platforms move along.
     

    Attached Files:

  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    You're going to have to provide a little more info on what you're doing. I also believe you've uploaded the wrong images, those squiggles aren't exactly related to the issue.