Animate multiple objects along spline (conveyor belt)

A little bit. My fault, sorry…

@pezzott1’s solution is really good!

Still, I want to fix my solution. Here’s what it would look like in the new form.
BP_SplinePath:

BP_Object/BP_Gift:

EDIT: Result:
ObjectsMoving_2

Dude! it works (almost) perfectly! So amazing. For some reason it’s not destroying them and they are looping so then I see 2 gifts intersecting after the first gift comes to the end of the loop.

Edit: Well duh, that’s super logical if I activate loop in the timeline… it all works now :smiley:

Works the same in UE4.

@LucidGem If you work with Unreal for your job, tell your boss you need a raise. If this is how you help total strangers on the internet, I can’t even imagine how valuable you are to your team.

Bless you for taking the time to help me out. Seriously, this saved me so much time in the end!

1 Like

Thank you so much! :face_holding_back_tears: It has been a pleasure to help.
Best of luck with Unreal!

@LucidGem One last question hopefully. I’m trying to give each spawned actor a random rotation. If I put in a SetActorRotation after the SetActorTransform and give it a random float in range for the Z axis, it just starts spinning rapidly:

image

I’m guessing this is because it is updating each frame in the timeline thus getting a new rotation? If I just set it to something like 30, it “works” but then they are all of course turned 30 degrees.

I think this is the right place to add it, but I’m not quite sure how to actually get it to just set it once.

Yep, exactly.
You have to save that rotation in a variable before calling MoveObject (in Init Object or in BeginPlay). Then you will have that constant value
image

After that, add that value to the rotation that the node “GetTransformAtDistanceAlongSpline” give you and put the result into the “SetActorTransform”. With this, the rotation of the spline is maintained but with an added offset :sparkles:

Once again, works perfectly! Thanks.

I wanted to have a bit more control so I added 4 floats and made it choose one of them randomly so the objects would only spawn at 0, 90, 180, or 270. The way I did it works fine as far as I can tell, but something tells me that there is a smarter way of doing it? Something along the lines of random int, but round up to the nearest multiple of 90 or something so then 0->89 = 90, 91->179 = 180, 181->269 =270, and 271->359 = 360.

Nice! :smile:

The array option is good if you want very specific numbers.
In the case of 0-90-180-270, maths can help!
image
0->0
1->90
2->180
3->270

I knew it could be that simple, couldn’t think of a way to get a random 1-4 integer neatly, but maybe I should read the tooltips some more. Thanks again!

You’re welcome! :smiley:
Don’t worry, take your time. The same result can be obtained in many ways. By asking yourself how is how you discover them!
You are on the right track!

Hello! good solution!
How to get such an array, please tell me.
image

Create a separate Struct, then reference that Struct as a Variable inside your Blueprint. See 3 Images above the one you’re referencing here.