Display of Traffic Density on roads
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:
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).
Eegeo::Streaming::MortonKey key = Eegeo::Streaming::MortonKey::CreateFromString("01131232132001");
int roadId = 0;
bool success = trafficCongestionService.TrySetCongestionFor(key, roadId, Eegeo::TrafficCongestion::CongestionLevel::Heavy);