Traffic Congestion

Display of Traffic Density on roads

Traffic Congestion

While the platform’s ambient traffic (also known as “clockwork traffic”) is useful for making the environment for interesting, it is not well-suited for conveying real-world traffic density (e.g. traffic jams). To make the visualisation of traffic density possible, we’ve added Traffic Congestion functionality. This visualisation can run in tandem with the existing traffic simulation (any roads used for congestion visualisation will be not be used by ambient traffic vehicles).

In this section:

Setting congestion

Manipulating the congestion settings is achieved via the Eegeo::TrafficCongestion::ITrafficCongestionSystem interface. You can get a reference to an implementation of this interface via EegeoWorld’s GetTrafficCongestionSystem() method.

By default, traffic congestion won’t be displayed unless you actively set the traffic congestion for a given road. To set the congestion for a road with a given id, contained in a road resource with a specific MortonKey, use the ITrafficCongestionSystem reference and call its TrySetCongestionFor method.

The return value of the method indicates whether the congestion level was successfully set. Cases that may cause failure include passing bad arguments (e.g. a MortonKey for a resource that contains no navgraphs) or arguments that are not valid at the present time (e.g. a MortonKey that matches no currently loaded road resources).


Example

There is an SDK example TrafficCongestionExample available here.

This example illustrates how to set the congestion level for a road contained in a specific resource whose morton key and road id is specified.