Make a Character/Vehicle follow spline

Is there a way to make a character/vehicle follow to spline line rather than just move from point to point, so it would follow the curve too etc.

Yup, with those:

Provide Time / Distance and Coordinate Space (most likely World in your case) and the Return Value will provide location, rotation and scale.


This has been covered nicely already, it seems:

https://www.youtube.com/results?search_query=ue4+move+along+spline

1 Like

That’s great thanks, I’m guessing I would only need to use one or the other?

You’d use only one.

Time is somewhat easier for the human brain to work with. If I give you a long spline of unknown length and ask you to point to a spot at 42% of the spline, you’ll have no issues. When you work with Time, you can work in a unitless fashion. Or you can work with actual Time, if you wanted to move to a location that is 3.5 seconds away, you can:

image

And there’s also Constant Velocity toggle for Time. Wouldn’t work well for a rollercoaster cart but could work well for a camera rig that needs to move in a very specific fashion.


If I give you a spline that is 7380 uus and ask you to point at the point at 3000 Distance, now you need to apply some mental gymnastics or worse, do math. :wink:

Both have their uses - kind of depends on how we approach things. You can use both simultaneously, but you do not need to.

1 Like

Thank you so much for this, I’ve not come across them before! Heavy night of head scratching to look forward to haha

To give you a headstart:

With spline duration set to 5s and Speed of 1, a single loop should take 5 seconds regardless of framerate:

If you need more control over the movement, do look into Timelines.

1 Like

I want to use it for race car ai, so I need to work out the acceleration and steering etc along the spline path but these will help massively thank you

Consider moving a dummy guide along the spline with some offsets. The vehicle AI should try to catch up with that guide. This would give you a more life-like intent behind the steering logic, as if there was a purpose.

1 Like