How to make a multi carriage train?

I have created a train that moves along a spline, I would like to attach multiple carriages on the back of the train that also follow the spline and stays on the spline when going round corners.

Please can someone help?

Here is the blueprint that I have for the train:

Rather than Set Actor Location and Rotation, try setting the world location + rotation of the skeletal mesh. From there you should be able to add a new skeletal mesh (make sure it can’t collide with the first), position it correctly, and then duplicating the code in your MoveTrain event.
There may be better alternatives than duplicating the code, but this should get you on the right track. Let me know whether or not this works and what the outcome is and I can try to help you out a bit more.

EDIT: If the train’s mesh is centered weird and you have to adjust the actors location, you could try duplicating the blueprint, putting it in the world behind the first and then attach them together using sockets.

Hi, thank you for your quick response!

I tried the first bit where I changed to Set World Location and Rotation, added the other skelatal mesh, and duplicated the code. Now the carriage just spawns inside the train. I have never done sockets before so could you explain how to use sockets if this is the best way to attach to the back? I have tried attaching the carriage to the train in the components list but nothing changes.

Here is what I have so far:

Move Train:

Move Carriage:

This is what happens when the train is detached in the components list:

352682-train-detached.gif

This is what happens when the train is attached in the components list:

352683-train-attached.gif

Hi, thank you for your quick response!

I tried the first bit where I changed to Set World Location and Rotation, added the other skeletal mesh, and duplicated the code. Now the carriage just spawns inside the train. I have never done sockets before so could you explain how to use sockets if this is the best way to attach to the back of the train? I have tried attaching the carriage to the train in the components list but nothing changes.

Here is what I have so far:

352683-train-attached.gif

352682-train-detached.gif

I did everything except for the sockets. I changed to the Set World Location and Rotation and duplicated the blueprint for the train and replaced it with the carriage. This has made the carriage run on the spline, but inside of the train instead of attached to the back of the train. Can you explain sockets as I have never used them before?

352682-train-detached.gif

I did everything except for the sockets. I changed to the Set World Location and Rotation and duplicated the blueprint for the train and replaced it with the carriage. This has made the carriage run on the spline, but inside of the train instead of attached to the back of the train. Can you explain sockets as I have never used them before?

352682-train-detached.gif

Try creating a new alpha variable and use it when moving your second section. If that doesn’t fix it, it could be that or you may need to lerp between the meshes current location and the destination location.