Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Using Unity's navigation system for cars on roads

Discussion in 'Navigation' started by DromoDesigner, Sep 13, 2018.

  1. DromoDesigner


    Mar 27, 2016

    I am trying to recreate cars travelling down roads (similar to the roads in Cities:Skylines, but on a smaller scale).

    I am having trouble getting the cars to stick to their side of the road in two-way traffic. I have searched online for a solution or tutorial, but cannot find one.

    Would you please be able to recommend a tutorial or guide on how to get car to travel down roads, so that they stay on the correct side of the road even when turning?

    Thank you,
  2. Yandalf


    Feb 11, 2014
    From what I know pathfinding on a navmesh might not really be a good idea for this.
    When it comes to cars driving around, you might be better off to define splines for each road that also contain a reference to their connected roads (turns and aheads on crossroads etc) and making your cars follow those instead.
    If you then make sure there's a spline on the road for each direction and provide some splines for making U-turns, you could get a pretty good basis.