Besides the engineering model itself, the most important element of a roadway visualization is the traffic. Most AEC visualization software has a built-in tool for placing cars, but since we were working in Unity it was something we had to develop ourselves.
While we eventually ended up with a fairly complex and robust traffic tool, it was something that developed slowly over time while working on other projects and adding features as needed.
The first piece I began working on was a simple path following behavior for pedestrians in a train station.
We wanted them to follow predictable paths to avoid the randomness that comes from using a navmesh/pathfinding, however we ran into an issue of paths needing to cross and pedestrians walking through each other.
To deal with this, I added a simple obstacle avoidance behavior -- basically just stop if you're about to bump into someone, and navigate around them if you're stopped too long.
A little while later, on another project, I began working on a tool to rapidly place cars in a scene and align them with traffic lanes.
The tool I built allowed us to draw a single path along a road and generate multiple lanes of traffic from it.
This included features found in other AEC software like the ability to have bi-directional traffic and adjustable lane widths.
For this first project we used a simple script to have the cars follow the lanes at a fixed speed, but this looks quite artificial and I realized my pedestrian behavior could be an improvement.
This allowed cars to drive at different speeds and stop if they're about to hit another car, creating much more realistic visuals while still being predictable and easy to debug.
And, as the scope of our projects grew, I added more features like creating a visual interface for connecting lanes together to allow for on- and off-ramps, as well as adding the ability for cars to merge and change lanes.
This tool was a constant work-in-progress, as different roadway layouts always required new features (curvier roads required different ways of looking ahead, having lanes end required more elegant merging etc.)
However we tested several other Unity traffic systems and all of them lead to unexpected behaviors, from crashes to cars driving off the road to falling through geometry.
Using the tool we developed in-house ended up being a lot simpler, and easier to debug if something went wrong.