# Priority Intersection

A priority intersection is an intersection that is not controlled by traffic lights. At a priority intersection, vehicles will continue through if there are no other vehicles inside the intersection. Otherwise, they will stop and wait for other vehicles to pass.

For a priority intersection to work it needs to have at least 3 roads (a 2-road intersection is a straight road) and there is no maximum number of roads for an intersection.

Usually, an intersection looks like this:

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2Fk5VOhSpxxBGMODKc4w2c%2Fimage_2024-02-08_154004492.png?alt=media&#x26;token=3671fa19-5451-46cb-8f82-628a2a921d9f" alt=""><figcaption></figcaption></figure>

As you can see from those red waypoints, the roads are not connected, so you should connect the roads as you see fit. Check the [connect-roads](https://gley.gitbook.io/mobile-traffic-system/setup-guide/connect-roads "mention")section.

I will connect the roads like this but you can do it in any way you want.

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2F22NhSi3aFQqd0AZoWrSV%2Fimage_2024-02-08_154222155.png?alt=media&#x26;token=e6f6fa90-ce22-4b38-aea3-0809d64e8a2f" alt=""><figcaption></figcaption></figure>

After all roads are connected, create a priority intersection.

Go to **Settings Window -> Intersection Setup**

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2FZEu8boNo6YB6q7hthJTW%2Fimage_2024-02-08_154524142.png?alt=media&#x26;token=dcf71b32-dba4-4204-a08f-5a0b5de1a24e" alt=""><figcaption></figcaption></figure>

If **Show All Intersections** is checked you will see the intersections from the entire scene. If unchecked, only the intersections visible in the scene view will be displayed. Using the **View**, **Edit,** and **Delete** buttons you can perform the respective operations on each intersection from that list.

Press **Create Priority Intersection** to create a new intersection. This will open the Priority Intersection Setup Window.

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2FdpBpbJTfK26Im0FyCCwJ%2FV2-PriorityIntersectionSetup.PNG?alt=media&#x26;token=f3a9af9f-5c5f-4057-9f40-46085429cb4f" alt=""><figcaption></figcaption></figure>

**Hide Waypoints** - will hide the scene waypoints offering you the possibility to select different objects inside the scene.

For each road that enters the intersection, you'll have to press **Add Road** and then **Assign Road Waypoints.**&#x20;

Select the waypoints where you want cars to stop. Selected waypoints will be marked with red circles.

When the selection is finished, press the **Done** button.

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2F0qALXWUAWz9CWLby7TSQ%2Fimage_2024-02-08_155157109.png?alt=media&#x26;token=a321ba15-9274-41e1-a972-520a32afb641" alt=""><figcaption></figcaption></figure>

Do this for all roads in your intersection.

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2F1p4YzVMpZVJJ4Puj2uVW%2Fimage_2024-02-08_155342515.png?alt=media&#x26;token=af05e481-4fc5-483f-b553-1ae66fdde01f" alt=""><figcaption></figcaption></figure>

You can add more waypoints to any road by using the **Assign Road Waypoints** button.

You can delete a waypoint or the entire road by using the **Delete** button.

Using the **View** buttons, you can focus the scene view on the selected waypoint.

**Adding exit waypoints is mandatory.**

Press **Add Exit Waypoints** and select all the waypoints through which cars can exit the intersection. Exit waypoints are marked with green circles.

<figure><img src="https://1500817731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuflU4iIzTBjoLH93zTYD%2Fuploads%2FDnxAleSOkVs4ECXzWYoX%2Fimage_2024-02-08_155748376.png?alt=media&#x26;token=69d059eb-0554-4c4b-a10e-429dc6951fa4" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
**Attention**! If a vehicle can exit from an intersection without passing an exit waypoint (you miss assigning an exit) the intersection will stop working thinking a vehicle is still inside the intersection and will not allow others to enter.
{% endhint %}

Check this video for more information.

{% embed url="<https://youtu.be/iSIE28UoAyY?feature=shared>" %}
