Make a vehicle change path

I am recreating a historycal italian railway. I am try to turn a little steam locomotive so I need to change path.
I found and followed this tutorial

I put two collision box one at the beginning of the spline, another in front of my locomotive. When two collision box overlaps each other the spline change.
I put both splines ( spline blueprint is the same), one starts on the end of the other one.
But when i launch the game my locomotive seems to actually change the spline but it moves on the last point of the second spline losing his position and rotation.
I looked for any other example but found nothing.







https://streamable.com/ldh7e0

Someone can help me?

im not sure if this is what you mean but getallactorsofclass is basically returning a random spline when you’d want the specific next spline?

1 Like

Thank you for your replay. Yes I would change the various splines in a sequence ( spline1 spline2 ecc. ) but I have found just the tutorial I linked before. There’s a second tutorial of the same author, which shows how to change a random splines so I followed the first one. I’m not expert but I understood that “getallactorofclass” make possibile the actor to “know” all exixting splines. And indeed the locomotive changes the spline but It Instantaneously moves on the last point of the second spline and there it no longer moves.

the code doesnt really make sense to me, you have a for loop with a massive delay, this just wont work. where are you telling it to move?

2 Likes

The massive deelay is a my customization to give time to make first the turning animation.
At turning complete it should change spline than moves along new spline. I don’t know if you have seen video on the last link in my first post. This is my idea but I can change everithing.
“For each” loop is not my idea it’s just what I followed on tutorial (first video).
I just want to find a way to make the right nodes to make it works.

i mean i dont think delays on loop even work but if it does its horrible practice.

im pretty sure what happens is the loop completes instantly but keeps retriggering the delay so you vairable will always be set to the last index in the array.

do any of those print strings trigger? im not even sure your getobjectname will pass since usually the engine will append a unique number since you may have multiple objects

1 Like

Thank You very much Auran.
I deleted massive delay and solved.