Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

NavMesh Road System

Discussion in 'Navigation' started by Martins74, Oct 11, 2017 at 9:42 AM.

  1. Martins74

    Martins74

    Joined:
    Jul 21, 2016
    Posts:
    8
    Hi, i'm making a an road system with car AI and it's working fine, but the problem here is that when NavMesh agent calculates a path to a point it calculates the fastest way going on the wrong road direction, i tried to use a off-mesh link but doesn't seems to work right any one has an ideia?

    [​IMG]
     
  2. Martins74

    Martins74

    Joined:
    Jul 21, 2016
    Posts:
    8
    I do have an ideia but it makes me creating a script that stores a parent and on the end of intersection on colliding it set's the NavMesh agent destination to the cube, but is there any better ideias.
     
  3. Advait88

    Advait88

    Joined:
    Jun 8, 2017
    Posts:
    7
  4. AdamAlexander

    AdamAlexander

    Joined:
    Jul 24, 2015
    Posts:
    35
    You could try adding a sequence of waypoints onto your track. These waypoints would be arranged along the correct side of the road and your cars would follow them in sequence. You could still use the navmesh for pathfinding but the cars would calculate a path to the nearest waypoint thats next in the sequence.
     
  5. Martins74

    Martins74

    Joined:
    Jul 21, 2016
    Posts:
    8
    Yes that is what i'm trying, it's working i disable the auto braking then save the destination on a temp Vector3 give the position of the checkpoint as destination and before he gets to the checkpoint i give him back the original destination and enable again the auto braking, now i'm trying to know when he actually wants to turn right or move forward i'm looking at Navmesh Agent Path that contains a list of way points where the agente changes direction i'll keep this updated.

    P.S. I disable auto braking so that agent doesn't stop moving when giving him a new destination ;)