Create a Road

Mobile Traffic System uses a road and lane drawing system to help you draw the paths for the vehicles. This road and lane information is used just inside Unity Editor, at runtime only the generated waypoint information is used.

To draw a road open the Settings Window and select Road Setup -> Create Road

Press SHIFT+ Left Click to add a road point. When you click the second time, a line will be drawn between those two points. You can adjust the curvature of the line by moving the anchor points (the small white ones) or change the position of the line by moving the control points (the red ones). Using this method, you can draw a curve to the center of your road.

If you press SHIFT+ Left Click between two existing anchor points on the line, a new anchor point will be added at that spot.

If you press SHIFT + Right Click on an anchor point, that anchor point will be removed.

The Edit Road Window will automatically open when you start to draw a road.

The Edit Road Window allows you to customize your road.

Nr Of Lanes - Represents the number of lanes your road will have.

Lane Width - Represents how wide each lane should be. It's best practice to generate the waypoints in the middle of each lane.

Waypoint Distance - Represents the spacing between two consecutive waypoints.

The global lane settings are applied to all lanes of the road. You can set the maximum speed and the types of vehicles allowed on all lanes.

By using Apply Global Car Settings, the car setup will be applied to all lanes, and by using Apply Speed, the speed settings will be applied to all lanes.

Apply All Settings will apply both car and speed settings to all lanes of this road.

Individual lane settings allow you to apply different settings to each lane. You can change the direction of a lane using the -> and <- buttons.

When all setup is done, press the Generate Waypoints button. This will automatically generate and connect the waypoints for each lane. These waypoints are used by the traffic vehicles to drive on.

The Link Other Lanes button creates connections to other lanes that vehicles can use to overtake each other. Vehicles will only overtake on these other lane connections.

The Link Distance represents how far away the other lane waypoint should be. For example, if set to 1, the link will connect to the first waypoint in front of the current lane one as below.

If set to 3, it will link 3 waypoints ahead on the other lane as below.

When you finish editing a road, press the Back button.

To edit a road, open the Road Setup -> View Roads

Scroll through the scene window until you find the desired road, then click Select in the list. This action opens the Edit Road window, where you can adjust road settings or continue drawing the road further.

If a road is no longer needed, press the Delete button. Alternatively, you can locate a road by using the View button.

Before entering play mode, ensure to press Apply Settings. If you've made modifications to your road network, pressing Apply Settings is necessary to ensure that the changes are applied in runtime mode.

This tutorial was made for the old version of the plugin, but all information from it is still valid and it should be watched for a better understanding.

Last updated