with a defined offset in groups of 5 (so 5 cars of one model, 5 cars of another model, repeat)
With my method I´m able to add the first model. I just started out with working in Unreal and Blueprints so I´m kinda confused how the loops work.
I tried to insert a loop before my AddStaticMeshComponent but then it appeared that instantly 10 models are spawned in the same place. I tried to add kind of some logic using modulo and calculation, which didnt really work out for me.
Right now it would be great if could spawn at least one of the car models in this defined offset.
This code won’t ‘port’ well to multiple cars, because the timeline can only run for one car at a time. If a second car comes along, it will reset the timeline for the first car, and so on.
There are several ways around this:
Put the car references and their current locations in an array. During the timeline, you need to loop over all the cars, and lerp their locations from the array.
or
Make an actor blueprint that contains the timeline and code to move the car. When you put a car on the spline, spawn one of these actors and it can move the car for you.
or
If you have N cars, just put N copies of this blueprint in the level, no problem…
Hi ClockworkOcean,
thx for the quick answer. I think I´m gonna go with the third option of putting N bps fpr n cars into my scene.
Maybe later on I´m gonna swap to option 1.
Now I have the problem that although I´m putting in a value for my OffsetTime, my 2nd car still spawns at the beginning of the spline.
Do I need to calculate this with a vector to delay it or can I simply use the function delay and multiply my duration with the index of the car?
Another idea I have, is to give my Lerp in bp2 an A which will be dependent of my index of car, so that my location, doesn´t begin at 0 of Alpha but at for example 0.05
at the end of the spline, do you think I can set the index of the car to 0 by using a hitbox? Like that every car should spawn at the first spline point no?