Traffic Lights Intersection

For a traffic light 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:

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 Roadssection.

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

After all roads are connected, create a traffic light intersection.

Go to Settings Window -> Intersection Setup

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 Traffic Lights Intersection to create a new intersection. This will open the Traffic Lights Intersection Setup Window.

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

The Green and Yellow times will be applied if the corresponding times in the Traffic Component are set to -1. See the Initializing Assetsection for more details.

The Set Green Light Per Road will allow you to set different green durations for each intersection road. If you have a large road that might stay on green for more time than the secondary road.

For each road that enters the intersection, you'll have to press Add Road and then Assign Road.

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

Select your red, yellow, and green light objects. They will be enabled when that light color is on and disabled when the light color is off.

Do this for all roads in your intersection.

Notice that if Set Green Light Per Road is active, for each road you'll have a field to input the green light time.

You can add more waypoints to any road by using the Assign Road 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.

By using the Add Exit Waypoints, you can mark all the exit waypoints from the intersection.

If a traffic light intersection has exit waypoints, the next road will not turn green until all the cars have left the intersection.

The exit waypoints are not required for the intersection to work

If you are using exit waypoints but a vehicle can exit from an intersection without passing an exit waypoint (you miss assigning an exit) the intersection will stop working thinking a car is still inside the intersection.

If an intersection does not change the light colors it might be outside of the active cells. See the Prepare Scenesection for more info.

Check this video for more information.

Last updated