Community Tutorial: Follow a Spline and Report Distance Along It Using an Actor Component

I followed the tutorial, used the project files but I get compile errors with UE 5.1.
Anyone know what I’m doing wrong?

Can you share your errors? Are they Blueprint errors? I haven’t opened the project files in 5.1, but I have migrated all the Blueprints to a variety of new projects without compile errors.

Yes, blueprint errors - and thanks for the tutorial, btw. They only appear in the Proceed to Destination function. I’m a UE novice, so it’s likely to be something I’ve done/not done at my end.

followSplineError

It looks to me like you are missing all references to the Chaos Vehicles. That class is missing from the GetComponentByClass, and it says it can’t find the function “Set Steering Input” because it doesn’t understand what it’s referencing. Maybe this project doesn’t have that plugin enabled? Unfortunately simply enabling the plugin may still leave you with some broken links in the nodes, in which case you might try to migrate again or copy and paste some nodes.

Thanks, . You were right, I wasn’t using (and don’t plan to use) any chaos vehicles in my project so my ‘fix’ was to bypass those references, delete the unnecessary nodes and plug everything back together.

1 Like

Thanks for your work, . but i have another question, i have a cpoy of your “FollowSplineComponent” in my own project, then i did something like below:

  1. generate a blueprint class named ‘NewAICar’ which inherited from ‘WheeledVehiclePawn’.
  2. attach ‘FollowSplineComponent’ to ‘NewAICar’.
  3. click simulate in UE5.
    but there is nothing happened, the ‘NewAICar’ just moved a very tiny distance, so:
  4. is there any setting about ‘NewAICar’ i have missed?
  5. would you please show me the process of setup ‘SportsCar_Pawn’ in your project?

If you look inside the “Proceed To Destination” function, the throttle only gets applied to classes that inherit from Chaos Vehicles. You could attempt to change that if you don’t want to use a Chaos vehicle.

I would guess that if you show the debugging inside the Blueprint editor you could watch the flow of logic and it would skip down to the “static mesh” fallback option, which attempts to manually transform the actor. But maybe your vehicle has some sort of braking applied? I really don’t know. I haven’t worked with that type of pawn before. I did not do any setup to the Sports Car besides adding the FollowSpline component.

Hi @.Phillips I’m having some problems with this could you let me know where I may have gone wrong please? Follow Spline: Character Issue - YouTube I’ll post another one relating to the car

Definitely need to clean up the errors first. If your BP is not finding the Spline, then it won’t know when or where to turn.

Two things might be problematic. In my example the variable in the Follow component is a specific spline class. So you either need to work with that paradigm and modify the class to do what you want, or modify the component to look for any old spline component that you want to give it.

Second is that you have auto-find spline turned on, but you’re also specifying a specific spline to follow. Best to turn off ‘auto’ just to keep it clean and simple for now.

For the third person character it simply uses the Add Movement Input, so make sure your pawn is set up the same way as the template character. Also double check that your pawn has the same rotation (default characters face down X but the skeletal mesh assets face down Y, which could cause you to rotate something in the pawn)

1 Like

THANK YOU SO MUCH FOR GETTING BACK TO ME! So I cant use characters they have to be pawns? All but one are characters and only the pawn works, so I need to add the move components/input system to the characters?

Character classes inherit from Pawns, so I use them interchangeably here. A Pawn is anything in the world meant to receive input from the player.

Ah okay! I couldn’t get the characters to work, but I have gotten the pawns to work. I will now endeavour to find the correct way to put a metahuman into the 3rd person character/pawn. Wish me luck on that one as last time I tried the legs didn’t animate aha. I will post a video to show you what’s happening with the car as that is still an unknown for me. Its a large track and I need them to go fast, and they lose/dont follow the spline when it comes to the first corner :s

Again, thank you so much for getting back to me as its for an urgent project!

I heard this one from somebody else too. My example code should somewhat reliably get the car to always steer towards the spline… but that’s it. I don’t have anything in there telling the vehicle to slow down around corners or put on the brakes if it reaches the end of a spline or anything. You’ll have to add that yourself in Blueprints. You’ll need some logic to slow down the vehicle if it’s doing a maximum turn (steering of 1 or -1). Or use the turning intensity as a throttle multiplier overall.

There might also be some wiggle room in the car physics. You can make the tires super grippy and the steering radius really tight to keep it more glued to its path, but in my example the physics will always be operating the vehicle and the spline path is just a suggestion.

That sound awesome and what i need! its just above my technical pay grade lol, Ill try to find something online to see how to

Great tutorial, very detailed and easy to follow! Thank you!

Hi @Stephen.Phillips

This is a great tool for what I do, thank you. I am currently working on a project that requires to reset the owner of the component to the first position or start position, is that possible? and if yes, can you please share a hint on how I can do that?

I am on 5.2 (if that is relevant)
Thanks.

UPDATE: after a while I tried to reset the percentage along spline variable and the transform of the owner, apparently is working as desired, but if you have a better suggestion, I’d be happy to hear it.

There are a variety of Blueprint nodes in the Spline category that could give you the starting point of the spline. You can get the world location of point 0, get world location at time 0s, get world location at distance along spline at 0cm. If something is working okay for you, then you might not need to worry about it.

1 Like

Thank you !!

Thank you very much for the great tutorial, it has helped us a lot.
We are currently facing a small problem and do not know if it is possible with the tutorial.

The idea (see picture) is that when the actor moves on spline1 and arrives at the end point, a decision is made as to whether it uses spline2 or spline3. Is that possible?

Sure. Part of what I provided was checking how far along the spline the actor is. So on tick you can check if the spline distance is greater than 90%, and if it is, then you can change the Spline Component variable to another spline component.