Search Unity

Question How to find path to one point not on Navmesh?

Discussion in 'Navigation' started by Wayne-wyj1994, Jan 11, 2021.

  1. Wayne-wyj1994

    Wayne-wyj1994

    Joined:
    Nov 13, 2019
    Posts:
    30
    I want to find path from Point_Start on navmesh ,and to Point_End not on navmesh.
    If I use Navmesh.Raycast ,It will stop at first obstacle point ,obviously wrong.
    The path I wanted is as below .but I can't get it because the path status of CalculatePath() is Invalid.
    Does anyone know how to find path like this?
    upload_2021-1-11_20-57-17.png
     
  2. NixyNick

    NixyNick

    Joined:
    Oct 11, 2020
    Posts:
    12
    Once you have your navmesh surface baked, you should be able to tell your agent: agent.SetDestination(your destination). This will make the agent go to the point you want and also will avoid any obstacles. Also a new Unity Asset called "Ultimate AI System", which I recently bought. It did all of that for me and didn't require any coding, so you might want to check it out.