Search Unity

NavMesh Road System

Discussion in 'Navigation' started by Martins74, Oct 11, 2017.

  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?

     
    Nuclear_Slingshot likes this.
  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:
    14
  4. AdamAlexander

    AdamAlexander

    Joined:
    Jul 24, 2015
    Posts:
    73
    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.
     
    dadude123 likes this.
  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 ;)
     
  6. MBraiN

    MBraiN

    Joined:
    Jan 17, 2013
    Posts:
    2
    Hi @Martins74 I have very similar problem to yours. Would you share what was your solution if you made it work please?