Multiple spline change

Hello. Is there a blueprint node which allows me to change multiple splines everytime i need?

You may need to clarify a bit. You can add Spline Components to an array and then run a For Each loop to change them all in one go.

I have a little train with a steam locomotive which follows a spline. Once it arrives on final destination, the locomotive detaches the train and moves on a sided track to attach the train from the opposite side. To make this possible I moved locomotive to the end of track which coincides with the last point of the original spline. Then It changes on another spline which make locomotive moves back on the sided track to make locomotive attach train from the opposite side. Once it arrives from the sided track to the original track where is the opposite side of the train I want to move back locomotive again and attach it to the original spline and then attach the train. So I need to switch splines multiple times and in different places.
I followed a tutorial which uses a collision box in the Spline BP to activate spline switching but in this tutorial the author places the collision boxes at the first point of the spline.

So there is a bunch of splines in the scene, right? Which BP needs to modify them?

There are two splines. One for the journey the other for change direction. The blueprint which should make spline change Is my locomotive blueprint. I putted one collision box in front of my locomotive which will collides with a collision box putted on the start of the second spline. When two collision boxes collides each other It starts “for each loop” function in my locomotive blueprint. To return on first spline i could not put another collision box on the second spline so I tryed to put a trigger box at the end of second spline to activate"for each loop" function but It not works.

Is it also already sitting in the scene? Hard to wrap one’s head around it without understanding how you set it up.


There are too many ways to fetch actor references:

  • there may be no need to do it at all - detect the same overlap in the level blueprint who can reference any actor
  • you could get the splines actors by tag
  • you could get the splines actors by class
  • you could expose an instance Editable array of splines on the locomotive and pick them manually from the level

Any of the above could/would work.


For example:

you could expose an instance Editable array of splines on the locomotive and pick them manually from the level

  • myLoco actor…

  • … is placed in the scene and can now choose the splines it needs to reference directly:

Would that work for you?

You are right. Later I wil put some picture for better explain. When I will be on my workstation I will try to follow what you said.
Thank you very much.

1 Like

This is my scenery with the two splines: Spline1 is journey, Spline2 is locomotive’s moving back path.

This is collision box in my spline BP

This is my locomotive BP.

This is switch nodes inside my locomotive BP

This is where my locomotive should moves back on first platform to attach the train by swithcing from spline 2 to spline1

And this is the result

  • you’re using a Delay inside a Loop - this will almost never work (I think I saw it mentioned in another thread of yours, too)
  • there’s no need for GetAllActors of Class here - above is you the exact method to get a correctly ordered array of very specific actor references - something that the abovementioned node cannot even guarantee
  • avoid string comparison as a rule of thumb; worst case scenario - use tags, or enumerators, or create an ID system
  • avoid using display/object name - you can barely rely on it in the editor; and you definitely cannot rely on it once shipped. Think of it as of a mostly debug tool. Print this:

Is this fine?

  • what you posted is nearly impossible to read

And this is the result

  • not sure what I’m looking at, sorry - hard to tell

Try what I suggested, you have both splines in an array. Get either 0 or Get 1 if there’s only two - this way there’s no need to compare anything or look anything up.

I am not an expert. All that I made, i made it by tutorial.
So I tryed and retryed so many times and nothing works.

I need to go on step by step.
I tryed to set an array as you kindly explained to me.


Now how can I switch the spline I need when I need?
Thank you for your patience.

Your solution works. I read a little guide of arrays how they works and once understood this i made spline been managed with array. And now It finally works. I hope to close this chapter. Thank you very very much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.