Traffic Manager
To optimize the system, there is a special class called "TrafficManager", which controls simulation in the specified area. It can randomly and automatically place cars and pedestrians only inside the specified area.
When the object escapes the simulation area, it will be disabled and will not waste resources, which will significantly increase performance. It also allows for the creation of dense traffic around the simulation object in the specified radius.
To set a Traffic Manager, put the "TrafficManager" class instance in the world and specify the following parameters:
- Simulation Radius - the radius, within which simulation will be performed.
- Freeze Radius - the radius, within which objects will be set.
- Cars Density - the density of cars.
- Pedestrians Density - the density of pedestrians.
To specify areas on which objects will appear, you need to assign a "SpawnObject" entity to these objects. This objects can be either ObjectMesh, or NodeReference with ObjectMesh as a root node. In this case, a SpawnObject entity will find a spawn_surface surface, and define triangles to put objects onto (objects will be placed only on surfaces with the specified slope angle).
Depending on the density, Traffic Manager will automatically place objects within this area. If you need to specify a particular amount of objects for this SpawnObject, just set the necessary amount to "Cars Count" and "Pedestrians Count" parameters.