Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

trying to make a car guide

Discussion in 'Scripting' started by danchavil, Jul 16, 2018.

  1. danchavil

    danchavil

    Joined:
    Jul 12, 2018
    Posts:
    32
    Hi,

    i making a car simulator, and i need tell to the driver the direction. my idea is make some like a waze.

    i take the curves and intersection like nodes, and use a line renderer to show the route to follow.

    all this works until need to find the shortest rout dynamically. because the start are aleatory and my algorithm
    works saving the nodes in a list.

    my question is, if the nav mesh agent have a function to show the shortest path or i need to program the dijkstra algorithm or the
    A*, or some have a idea to make some like this

    thanks.

    my idea example

     
  2. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    450
    I'd probably go with A*, because you can also modify it from shortest to fastest way using Cost of Travel. And it's easy to implement, also with your List of nodes.
     
  3. danchavil

    danchavil

    Joined:
    Jul 12, 2018
    Posts:
    32
    yeah, thanks for the idea. and you are right, i need use the A*.