Search Unity

Question A NavMeshAgent can change his generate path ?

Discussion in 'Navigation' started by FlorianVal44, Jan 24, 2023.

  1. FlorianVal44

    FlorianVal44

    Joined:
    Oct 17, 2020
    Posts:
    4
    Hi guys !

    In my game project (2d isometric), I need some characters to use roads to move around.

    I am using the navmesh (with the collision system) to generate the path to the destination (in pink) but I would like to know if it is possible to change this path to a path constrained by a route system (in yellow).

    editor-navmeshagent.jpg
    (NavMesh with collision system)
    navmeshagent.jpg
    (Pink : default AgentPath // Yellow : the path I want to create)

    My question is simple: Is it possible to modify the generated path (pink) by the one I want to do (yellow) by setting up a grid system and a rewrite of this path with respect to this constraint? (or maybe another solution)

    Thanks in advance ! :)
     
  2. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    You can create Blank Boxes simulating the Path, give them a certain Layer and just Bake those.
    ofc. put them under the road so it fits your path/Level Design
     
    elbriel likes this.