Search Unity

  1. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

How to use NavMeshQuery on several surfaces connected with NavMeshLinks?

Discussion in 'AI & Navigation Previews' started by snorkysnark, Apr 29, 2020.

  1. snorkysnark


    Oct 31, 2016
    I'm trying to make a game that needs lots of entities to navigate on the walls of a room, so I wanted to try DOTS for that.
    As far as I can see, all the existing DOTS navigation solutions use NavMeshQuery in tandem with PathUtils.FindStraightPath from the Unity Austin Demo.

    Using NavMeshComponents, I set up a scene with a floor and a wall connected via a NavMeshLink.

    As seen on the screenshot, a normal NavMeshAgent goes through the link correctly, while the PathUtils path always goes through one of the link's corners, resulting in a janky path. The PathUtils algorithm was probably intended for flat surfaces only, but I don't understand is well enough to fix it.

    So, how do I calculate a correct path from the list of PolygonIDs returned by the query?