Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Easy Way to Move Multiple Objects

So I think there is an issue with my logic. I'm basically trying to find a way to have multiple moving blocks or platforms. I have no issue doing this with multiple blueprints, but there MUST be an easier way to do this. I want the objects to move from point A to point B, I have the timeline set up and i have a single object doing this with no issue, but I didn't want to have to create a different reference for EACH moving object. The best way to explain is like this:

I want Object_01 to move from Point A to Point B on a vertical axis.

Object _02 will be 1000 units down the X axis from Object_01, and will move between its own Point A and Point B.

Rather than create a separate Sequence for each of these objects with its own reference points, it seems like logically there would be an easier way to achieve this. I thought of using an array of the objects and then just using a ForEach loop to set the start and end point, but then each run through the loop would have to have a different Start and End point, leading to the same issue in a different area.

To reiterate what i'm trying to achieve, I want to be able to have as many objects as i want in my level move on a Timeline loop from point A to point B, but each object have its own Point A & B without having to have a ridiculously sloppy level blueprint filled with references galore.

Product Version: UE 4.18
more ▼

asked Jan 24 '18 at 09:30 PM in Blueprint Scripting

avatar image

3 1 2 3

avatar image Reevez.God.420 Jan 24 '18 at 09:38 PM

This is a screenshot of the Level BP i have that works for the single object at this point. This works for the one, but i'd have to set this up for each running a Sequence to have multiples. I know i could create a function for the bulk of it and then just call the timeline in the middle, but is there an easier way?

alt text

moveableobject.png (94.2 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

One way to do it:

Give each object the start/end locations and its own curve. Then use a global time-elapsed to drive them all. When they spawn they get added to the list. Then, on tick (or timer), go through the list and tick each one. The alpha will be the same for all of them but each will be able to follow their own curve between their own start/end points.

That would be a more dynamic way to do it. But the simplest way is to use multiple tracks in a single timeline to drive all the objects. If you know you will have a (low) fixed number of objects, this might be the easier way to go.

more ▼

answered Jan 24 '18 at 10:01 PM

avatar image

4.4k 32 79 42

avatar image Reevez.God.420 Jan 24 '18 at 10:17 PM

So this is what i was essentially trying to avoid. I went ahead and did it for the sake of being able to give a better representation of what i meant. How would i thin this out? It seems like this is a lot of BP for moving only 3 objects. I'm not really understanding what you mean. I get the concept of it, but i don't know how to assign each object to the timeline without adding references as i've done in the following ss. alt text

moveableobject.png (204.9 kB)
avatar image Jin_VE Jan 24 '18 at 10:25 PM

My first suggestion would mean that instead of using the Sequence to handle each one explicitly, you add them to an array (i.e. at BeginPlay). Then you replace the Sequence with a ForEachLoop that goes through the array and applies the Lerp to each one in the same way.

Your image is very blurry so I can't give anything specific to your code, but that's the basic idea.

The timeline suggestion was assuming you weren't Lerping -- that each object needs to move on its own curve. For this, you open the timeline and add more tracks, one for each object you want to move. If any two objects can share the same curve then attach them both to that track. Lerping a timeline is a bit redundant so either use the timeline curve or use an elapsed-time counter to drive the Lerp.

avatar image Reevez.God.420 Jan 24 '18 at 10:33 PM

Okay, i see what you're saying now. But they all use the same time curve, therefore the Lerp can absolutely be done with a ForEach loop, which I will change to. But what about assigning the start and end locations for each object? Are you suggesting assigning the start and end to the object itself rather than in the Level BP? (I'll add 2 closer SS to make it less blurry, my apologies. I've added one of each side)

alt text

alt text

moveableobject2.png (296.7 kB)
moveableobject.png (357.2 kB)
avatar image Jin_VE Jan 24 '18 at 10:38 PM

If the objects have their own BPs then you can add the start/end locations variables to those. You could also keep two more arrays in the level BP: one of start locations and one of end locations. They should match up index-wise to the array of objects. Then you can use the same index for the start/end arrays as you do for the object array.

avatar image Reevez.God.420 Jan 24 '18 at 11:04 PM

Give me a few minutes to work with this. If i can get it all put together, i will mark this as resolved and up it. I have the logic of it down, but since i have 3 movable child objects, i only have the child BP to work with and i can't set the start/end locations for each, only for the first one. So i'm trying to put all the Start/End locations into an array and then figure out how to break the index into a location vector to plug into the start location set for the actor.

avatar image Reevez.God.420 Jan 24 '18 at 11:58 PM

So basically on Event Start i had the level BP "Make Array" for each object, each StartLocation, and each EndLocation, creating a variable array for each, then ran it into the timeline and set the Alpha to a variable.

After that i went to Event Tick and ran a ForEachLoop with the Object array as the Array. Array Element Output ran to 2 SetActorLocation functions, and the Array Index to 2 separate GET Array (one for StartLoc and one for EndLoc, the array variables i had created earlier) and ouput the GET's to their own GetActorLocation. I'd go into further detail, but i think a SS will suffice for anyone that has this issue in the future.

Much cleaner and functions perfectly. Thanks so much for the help!!!

alt text

alt text

moveableobject.png (260.8 kB)
moveableobject2.png (169.7 kB)
avatar image Jin_VE Jan 25 '18 at 12:01 AM

Glad to help. Just know that looping on too many objects every tick will cause performance issues at some point. You can instead create a timer and set it to tick fast enough to animate smoothly but no faster.

avatar image Reevez.God.420 Jan 25 '18 at 12:02 AM

Okay, as a bonus i'll toy with implementing that. Thanks for the info :D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question