One can now start and stop a train by clicking on it. Trains now spawn from the green boxes, and disappear into the red (yellow stations are there, though they don't mean anything yet).
Also, implemented a collision-avoidance system. First, tried casting a ray (which is very like shooting a laser detector) ahead of the engine to detect if it was about to hit another train, and if so, stop by itself. But it was too unreliable. Next, I sent an empty gameObject ahead of the engine to collide with other trains. It behaved exactly like any other train car, but without the geometry. An invisible car zero, a "ghost car". The ghost car can safely hit another train and stop the real train behind it in time. This works a lot better. In cases of two ghost cars hitting each other, the train that has existed the longest gets the right of way. Seniority!
83 hours in.

No comments:
Post a Comment