I’m trying to move an object along a curve from point A to point B.
Every time I press the “F” key a new object is “spawned” that does the journey from point A to point B.
The problem is when I press the “F” key again to “spawn” a new object the initial object stops moving.
I would like it to continue animating to it’s destination regardless of how many objects I spawn.
Here is a screenshot of the object stopping as soon I press the “F” for the second time.
I’ll need some more time of looking into this to find the actual solution to your problem but I can at least point out the reason as to why it’s doing this. Whenever you call the function a second time, it triggers the timeline to “Play from Start” again. This resets the previous timeline so the existing object gets stopped in its tracks.
Thanks for the quick response.
I understand what you’re saying. Somehow I would need to get a new instance of the Timeline every time I spawn a new object
you may want to put the movement logic in the actor being spawned. so in the spawned actor, create custom event ‘initMovement’ or whatever you want to call it, and make sure that custom event requires two input parameters, source and target location. then in your original blueprint, when you press ‘f’, and spawn the new actor, get the return value from that spawn, and pass the source and target location variables from your original blueprint to the custom event input parameters in the spawned object. at that point, you can do whatever you want with the information passed, regardless of anything else going on in game. (so if you wanted, you could recreate that timeline in the blueprint of the spawned object, and remove it from the original blueprint where you are pressing ‘f’. )
I believe the reason paradoc wanted you to move the Timeline’s logic to the blueprint of spawned object was so that there would be multiple instances of the Timeline as each instance of the blueprint is separate. I’ve not tested this myself so I’m not 100% sure if it’ll work that way, but that would be why you’re getting the same result with the Level Blueprint. There is only ever 1 Level Blueprint at a time so the same Timeline is being called and reset.
It seems that you currently have one of the “JourneySpawner_Timeline” under the level which is be referenced by the Level Blueprint through a “Getter” node. This results in the first instance of the JourneySpawner_Timeline getting called every time you hit F and executing its “Plot Journeys” logic which include its timeline. It does however get the reference to the newly spawned JourneySpawner_Timeline and executes all of its movement logic on that making it seem like the new instance is the one controlling all of this logic.
Luckily, this is easy to fix. Inside of your level blueprint, instead of hooking the “JourneySpawner_Timeline” reference from your level into the “Target” on “Plot Journeys”, hook the “Return Value” from “SpawnActor Journey Spawner Timeline” to the “Target” on “Plot Journeys” and it’ll make it work perfectly fine.