August 2015 Summary

Hey, look at that. August has gone by.

This past month I’ve been working in Unity3D on creating roads dynamically (as in mesh generation). I’ve done mesh generation before, but not in the context of a larger project.trafficai

There are lots of interesting problems with this. My general structure is to have road objects and nodes, where the nodes connect the road objects. I also have the concept of lanes, so each road has one or more lane objects. Then, using iTween, I can make car objects follow lanes and transition through nodes to other lanes.

Making nodes work was hard. I created a “pushback” algorithm that “pushes” back roads away from the nodes such that there is no collision between the roads and cars have appropriate space to turn. I should mention the nodes themselves have mesh generation so roads connect smoothly (even of different widths from different number of lanes, wider lanes, etc).

Ultimately I wish to make a traffic simulation. That adds new complexity in simulating human behavior, such as not knowing the entire system’s traffic. But there’s a long way to go yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.