Train cars to follow other train cars

I’ve tried everything I can think of, but nothing really works.

I am trying to make a 3D railroad simulator as part of a school project. I cannot think of a single satisfying method to make a train cars follow each other. Honestly, I’m dying here.

All I need is for a car to follow a locomotive, which has another car following that car, so on and so forth.

If you help me and your method works, I will give you the model I am using. It is a SOO Line SD60. Thanks in advance.

If you already have the code to make the loco move along and follow the tracks, why can’t you just put that same script on each of the cars? Alternatively, hinge joints might help, especially if you’re using physics simulation to constrain the rail cars to the track.

Without knowing more about what you have so far, and what problems you’ve encountered, it’s difficult to be specific…

Bones. Have them where you want the rotation and let your tracks and code do the rest.

Another cool way is for a raycast. Detect if the tag “train” (can you have custom tags?) is within the raycast. If it isn’t, speed up. Have another raycast that will also detect if its getting too close. I predict this would make a cool effect…