0
Answered

Patrol behavior - Loop is not a solution?

Ratzschaaf 3 years ago updated by JasonJonesLASM 3 years ago 9

Hi folks,
I've got a list with a few objects and a sphere which should move to the first object in list, then to the second, then to the third. etc. When I start play mode, the loops do all the transitions simultaniously. I need a working solution for the transition over time but don't know how to do in bolt. Can somebody help me with my problem?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1
Answered

Hi Ratzschaaf,

Loops don't iterate over many frames. They do all their steps in the current frame.

Looking at your graph, what you would need is tweening. There are many tweening libraries that exist, and I'm hoping to implement DOTween built-in as part of Bolt in 1.3.

In the mean time, some users have created Super Unit wrappers for DOTween: https://support.ludiq.io/forums/5-bolt/topics/525-floatto-dotween-wrapper/

I would like to use a loop to repeat Fade Text Action (DOTween), but It's like you say. Loop doesn't like to wait, in other words, Loop is executed without anything to stop it.

I'm using FloatTo - DOTween Wrapper v1.1.2 and loop neither not working. Here is another fade text logic, It doesn't work either:

I expect a new Super Unit loop logic. Lazlo, amazing work! (:
+1

Here I am again lol what Lazlo is saying is true though, you are still executing an over time loop 4 times per frame. It does not happen over time, so what it will fire off 4 consecutively, each when completed fires off 4 of the next immediately. Nothing will wait for another iteration to happen with a basic for or for each loop. What your really looking for is what is coming in 1.4 with the new wait units. They should be nestable according to Lazlo. In the upload of my source files, my wait unit, that covers pausing, breaking, stopping and resuming loops over time. This should work for what you want, but you have to handle nesting logic though by pausing if you fire in a loop.

Just to be clear, you're not having trouble with the routine macro itself though, right?

Oh, thank you! Not at all, it works perfectly. Would you like explain to me how to pause each iteration?

+1

a pause will need to be added to the routine itself if you want to pause those, but to pause the executing loop, when a routine is started in the loop, you can Sequence to the wait loops pause, or fire a "pause" custom event into the pause flow. On complete of routine, send another to resume to do the next iteration.

Exactly! But I have no idea how to do it. Perhaps you would like explain it with a graphics solution. Thank you anyway, fade text logic for a loading menu doesn't work for me at the moment :(

+1

Totally, I can only agree. I've fought really hard to try and figure this out. Actually I have a single possible idea, and it plays off how I accomplish the return event. What you'd do is have a macro that holds information about that loops state. Output that directly to the next loop, in each loop could have it's own stuff to pause that wired in event and resume upon that loops completion. So just one output connection to the next loop, no need to manually do the pausing unless you want.

Nesting should exist in 1.4, but maybe I'll try this. Do you have a Discord account? I can have you test your use case. I already have coroutine macros up that I will just embed inside, so could be done semi easily.

Oh great! Thank you! I spent the whole day trying to solve the puzzle. It's insane. Of course, my discord tag is GRAWORG#5099. I was just having dinner sorry for delay

+2

Just so no one comes back and is like well.... did they solve it, how do I do this? I think so. Essentially using some of the custom units put up before. Depending on Lazlo's implementation, probably will work in similar ways. Maybe this will help you too Ratzschaaf. Here is the result: 


You can snag the Wait Loop units here as a seperate thing by itself. It has been updated to fix namespace if you also use the Coroutines.

http://www.lifeandstylemedia.com/uploads/bolt/WaitLoopUnits.zip

*Correction: Stupid oversite, but essentially just use the float complete to another float to routine, which on complete goes back to the first ones start. There is no breaking, would needed added to the macro manually.