• News

• Industries

• Learning & Support

• Community

• Marketplace

So I wanted to talk a bit about vehicles.because I don’t feel like theres much information surrounding them aside from the car blueprint from epic. Even with the car blueprint bit feels restrictive since I’m just changing the values for drag ,speed ect . I want to build a train that will follow along train tracks . And will rotate and turn towards the direction of the train tracks. However the challenging part is how would I make a. Train follow along a path that closely resembles the train . Anyone got any creative solutions on one practical way of approaching this problem? Plz and thank you

Ok I feel like solving problems so here’s what I’ve got. I hope this picture makes sense. The picture shows a 2 car train following a curvy path.

Basically the wheels move according to the vector that is perpendicular to their axle on the track as you can see in green, which you can set the wheels rotation based on this. This isn’t the entire solution but I thought this would point you in the right direction :).

I wonder how i would get a value like the angle of the train tracks so i know what rotation the axles should be…HMFP

Hello,
i just did this for a character with splines: it goes up to stairs and where you want by creating a spline line in editor like you can find in cont example spline map:

&d=1416484111

Well one way to do this is to first design a track that can be modeled by a math function that is continuous. Then once you have that, you can do what is called “differentiating” to find the slope of the tangent line at each point along the track. This corresponds to those green vectors (in 2D) I was showing you on the picture. With this, you can rotate the axles correctly with each tick of time and the train will look like its traveling on its path with which is what you want.

How exactly would you start to implement math functions? Sorry I’m kinda new to this. Would you do it with blueprints . Or is it only possible in the c plus plus

Oh yeah I just remember math hall

It should be possible with blueprints (math expression nodes). I’m also pretty new to blueprinting, but check this video out -> https://www.youtube.com/watch?v=SncBymV7sIs

Is this somewhat like what you want? Notice how the train moves in a path that is not straight. The developers did a good job in my opinion, but I don’t know how they did it; they could’ve done what I keep mentioning even though you never see the train wheels that much :p. Again this approach takes careful planning, the level designers need to make a train track path that can be easily approximated by a math function, that way the train’s rotation and position can change correctly over time.

Awsome I will definitely give the blueprint math functions a look. I had no idea they even existed . Thx for telling me about em

Splines! I forgot they had that feature . How do they work exactly?

Check out this tutorial by Dokipen, he shows you how to create a road tool using splines which should work well in your situation as well just instead of a road use train track meshes, and have the train use the spline as it’s path to follow

I actually just watched the tutorials myself and Splines do make things a lot easier. Yeah I guess if I was to solve this problem I would use Splines with some 3D Calculus to determine how to keep the wheels rotated correctly on the tracks during travel.

Did you take like extra math courses or something? How come you know you will have to use 3d Calculus. I’m only in highschool so its kinda annoying to figure out i need to use calculus to make my train right