How to resend a pulse after an animation is done?

image

how do you manage this situation?
in the example above, there are two situations that are kind of annoying: “OR” pulse and the wait for animation to end in order to allow next pulse

in the graph there, if the user taps the screen, it will send the pulse, while starting a 1.5s animation, and until that is done, the switch remains “ON” so no new pulse is sent down the line.
But the problem is that if the user taps before the 1.5s window, the animation resets and its again 1.5s until a new pulse is allowed through… but we might now be 2.5s after initial pulse.

so… how do you fix that? without patches freezing thinking they are in a loop (which they are not, but… like when you connect “complete” on the animation to the “reset” on the same anim node. should create a loop like behaviour in the worst case, and yet it considers it as a logic loop and freezes all patches)

a complete question tends to have the answer in it somewhere right… ok I remembered that there is a delay node now… and it also works on pulses… that should do it…

// edit:

no wait… and how do i know there has enough time go through if the user sends two or more pulses one after .5 seconds of the other… there will be also two (or more) “off” pulses in that order… thus allowing to interrupt the next animation if triggered right away

the result of the “or” pulse is the one that should enter the delay… and i bet that is a loop right there…
yep… it is. and its not fixable by using sender/receiver either

The problem here is you reset and play the animation patch at the same time, so it ended up not playing at all. Using delay patch of 0.1s should work.

actually reset activates before play, so that part works.

tried setting two delays with a small one for the “or pulse” and a bigger one for the animation itself, but as the second one gets a pulse amidst the 1.5 seconds, there will be a resetted animation if the user sends the pulse continuously

i would need a way to clean the “delayed stack” of pulses after certain time, and there is no way to do that either (and if there were, it would probably jump as a patch loop too…)

Hey,
I think I may have just made a setup that somehow does what you seem to want. You can screen tap to launch the animation (creating the initial pulse), and the second animation player will act as a block for any reset happening before the end of the first one. I tested and it seems to work, during the first pulse you can screen tap all you want, it won’t reset or do anything until the initial 1,5s are over.
(ignore the plane ofc, just used to visually make sure of what I was testing)

1 Like

regreatably I dont think that works…
if you send another tap before 1.5s pass, it will reset the control animation and play it again, so if it was already started, lets say at .4, it will be zero again and counting, when it reaches reset value (one) the main animation will alkready be 1.9s since its start, right?

so if the user taps at 1.6s, the main animation wont start as it has not reset yet.

also, if the user taps a lot in between, like sooner than 1.5s (which should be expected), then the time before the main animation gets reset is ever expanding, as the control animation never reaches 1.

I think the only solution is “hacking” it through use of scripting, didnt write it yet, but it should be relatively easy to make

1 Like

ah you’re right, getting back to it, if I hit the reset while the animation is playing, it doesn’t reset the animation, however it delays the time it takes before you can reset it. mmmmh…

(15min later…)
Yeah so I tried several ways to bypass it and of course every solution that seems like it’ll work is unfortunately blocked because of the patch editor loop problem. I think @josh_beckwith told me once you could bypass this by throwing the value into script and directly back out.

2 Likes

yep, thats the only solution I can think of, while spark doesnt realize we are kind of cheating its loop control lel

1 Like

It’s a bit frustrating because it COULD work as far as I can tell. I want to make a proposal for this feature because it would save a lot of confusing workarounds in games. We could even make some physics patches if we had values that cached themselves at the end of a loop, just like delay frame does.

3 Likes

just a “reset on complete” boolean for the animation node would be enough, maybe extend also to add “loop x times” > “loop infinite times if x = -1”, or edit the loop node to allow that behaviour, but having just one animation node may be the simplest solution really

1 Like

also, the persistent value node would be incredible, I suggested that as well, it should work with an input for the number and an input to “freeze” that number.

pretty much like an offset node, but freezing the value. dont know why we dont have that one really, would be extremely useful

2 Likes