Waypoint Properties

When a waypoint is clicked inside the scene the following window is opened inside the Settings Window.

Colors

The green rectangle is the selected waypoint.

The blue rectangles will be its neighbors (waypoints available to continue without any restrictions).

The yellow rectangles will be its previous (waypoints from which the current waypoint can be reached).

The magenta waypoint will be the other lanes' waypoint (waypoints from which a vehicle needs to make sure are free before going into them).

The colors can be modified using the color sliders at the top of the window.

Position adjustments

By pressing Select Waypoint the Gameobject representing that waypoint is selected inside hierarchy and its position can be adjusted by moving its Transform.

This is useful to make small adjustments to the path.

Giving Way

There are 3 types of giving way that can be configured at the waypoint level: Simple Give Way, Complex Give Way, and Zipper Give Way.

You can learn more about them inside Setup Give-Way Waypointssection.

Trigger Events

Sometimes during gameplay, you need some events if a vehicle reaches a particular waypoint.

Enable the Trigger Event checkbox and give it a name or a piece of meaningful information inside the data field as a string. That information will be passed to the event listener.

Here is a simple example of how to subscribe and use those events:

using Gley.TrafficSystem;
using UnityEngine;
public class Test : MonoBehaviour
{
    //a reference to vehicle pool and player assigned in inspector
    public VehiclePool vehiclePool;
    public Transform player;

    void Start()
    {
        API.Initialize(player, 20, vehiclePool);
        Events.onWaypointReached += WaypointReached;
    }

    /// <summary>
    /// Triggered every time a waypoint with Trigger Event box checked is reached
    /// </summary>
    /// <param name="vehicleIndex">the vehicle index that reached the waypoint</param>
    /// <param name="waypointIndex">the index of the waypoint</param>
    /// <param name="data">the data from the settings window</param>
    private void WaypointReached(int vehicleIndex, int waypointIndex, string data)
    {
        Debug.Log(vehicleIndex + " " + waypointIndex + " " + data);

    }

    private void OnDestroy()
    {
        Events.onWaypointReached -= WaypointReached;
    }
}

Speed

Set the maximum speed allowed on this waypoint in km/h.

For more information on how to use this property see the Speed Routes Setup section.

Spawn priority

Spawn priority represents how likely is for a vehicle to spawn on this waypoint. the higher the value the better the chances.

For more information on how to use this property see the Waypoint Priority Setup section.

Waypoint penalty

Penalty is used only in pathfinding. A higher penalty will make this waypoint less likely to be included inside a path.

For more information on how to use this property see the Set Waypoint Penaltiessection.

Allowed vehicles

Check or uncheck the vehicle types that are allowed to pass through this waypoint.

For more information about this see the Vehicle Routes Setupsection.

Add/Remove neighbors

Using the Add/Remove Neighbors or Add/Remove Other Lanes, you can manually add or remove connections from the selected waypoint.

When you press the Add Neighbors button, all available waypoints will be displayed inside the scene and you just need to click a waypoint to create a connection between the current waypoint and the clicked waypoint.

If a connection exists between two waypoints, if you select the destination waypoint, the connection will be removed.

When you are finished editing, just press the Done button inside the Settings Window.

To view a waypoint, press the View button and the scene camera will zoom in on that waypoint.

To delete a waypoint just press the Delete button from the Settings Window.

Last updated