x

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"

Loop for a spline

Hello there, So I'm trying to make an object to follow a spline in a loop. As of right now, I've got the object to follow the spline but it only does it once. Whenever it does goes around the spline it stops. Please help me. I'm pretty new to Unreal Engine 4 and all the blueprinting stuff. Here is the blueprint that I have so far.

alt text

Thanks!

Product Version: UE 4.19
Tags:
more ▼

asked Apr 08 '18 at 03:20 AM in Blueprint Scripting

avatar image

Area51_Raider
1 1 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Hello Parkyeeun,

Had never thought about moving a object along a spline in this fashion, especially as the "Event BeginPlay" is only called one time. Hence the "Time" node must be invoking to keep the movement going (assuming that the movement is not completed in just one call, I.E. the object moves from the start point, to the endpoint with just one call, which if that is the case, the Event BeginPlay is your issue, in that it will only be called one time).

Personally I would set it up to be driven by a Timer, or the Tick. I would in the Event BeginPlay, grab the length of the spline (if it is not changing at run time), and just store that off in a variable, if I needed it, or during the construction of the spline if that is being done at Construction time of the Blueprint).

If you know the object is being moved more than one time before it stops moving, then I would suggest that the value that you are using from the Animation Pin, from the Time Node, has went to a constant value, hence it would look like it was not moving, because the value is never changing. OR The Time node itself is no longer being called. Either of those would stop this blueprint from working as you desire.

But if I was you, I would choose another way of driving the movement, unless you are using some animation that is important to you.

Hope this helps,

Jay

IceWare

more ▼

answered Apr 08 '18 at 04:49 AM

avatar image

jayice
1.4k 41 28 56

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

While I fully agree with Parkyeeun and this approach would make more sense in some / most scenarios; you can loop the Timeline easily with a CustomEvent, like so:

alt text

capture.png (49.8 kB)
more ▼

answered Apr 08 '18 at 10:12 AM

avatar image

Everynone
15.3k 77 26 64

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Try adding WhileLoop to the Graph. alt text

cevap.png (110.1 kB)
more ▼

answered Aug 22 '18 at 10:00 AM

avatar image

ElectroBridge
0

avatar image ThompsonN13 Aug 22 '18 at 02:20 PM

that is a bad way to try to accomplish this. using a while loop here would be bad on so many levels. first a while loop like all loops runs between frames so this could easily cause a slowdown / stuttering. next looping a script back on itself like this is not a good practice, it makes things messy, hard to read, and can cause more issues. if you really wanted to create a loop like this (not that i would condone it) you would be much better off using a delay node instead as it doesnt contain nearly as much logic.

the proper was to accomplish what the asker wants would be to use a custom event to loop the script as show by everynone or by creating a different movement method as mentioned by jayice.

avatar image Everynone Aug 22 '18 at 02:28 PM

Also, the Timeline can be just set to Loop if it's very simple looping one is after.

(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