So how to delay rotator?
For example After im activating G1 and then i have to wait 5 second until Rotator start Rotating
(help)How to delay Rotator?
42.5k StarlightRE
4.6 years ago
So how to delay rotator?
For example After im activating G1 and then i have to wait 5 second until Rotator start Rotating
Hey y'all I came across this looking for an answer but if there a way to delay the rotator in both ways (press it once and it'll delay first. Press it again and it'll delay before going the other way)
@spefyjerbf Thank you
@scottb13101 Try the following:
ceil(smooth(Activate1, pow(10,10), 1/delayTime))
Replace “delayTime” with how long your delay is, in seconds.
@spefyjerbf i know this is an old post but it’s the only resource i could find on this. I need to use i delay like this for a build i’n working on but i need it to work in the other direction. I.E deploy instantly but be delayed on returning. I messed around with the function but i couldn’t figure it out myself.
@spefyjerbf Can I ask how to delay deactivate rotator?
Ex: After deactivate G1 I have to wait 2 seconds until it stop rotating?
@spefyjerbf it works,Thanks :)
@Flightsonic Definitely. The conditional statement, in the function that I call the bidirectional delay, really just changes how fast the smooth function rises or falls. In most applications, it is best to have the function fall really fast. However, the function can be generalized to have any rise or fall rate. Just replace the big number (pow(10,10)) with another rate.
.
For things like landing gear doors, using a different rise and fall rate can be pretty useful. I think I used similar logic on my weapons bay doors on Orbidyn-L. Don’t remember entirely though.
@spefyjerbf ohh I see now, thank you, although if I needed delay on the rising and falling action, like for landing gear doors and such which would be better? I'm hoping to use some of this more as I get the math behind it, just not necessarily what the applications need
@Flightsonic No problem. I like talking about funky trees. That code should work, too, for a basic delay function. If you will be using this delay more than once, then you will need this modification:
.
The smooth function needs to return to its default state instantly when Activate1 is false. To do this, add a conditional statement in the delay part of the code.
.
While the technical documentation that I mentioned is really dense, it does shed some light on why the conditional statement is nice to have. Feel free to check it out. The TL:DR is that the smooth function, in its basic form, isn’t reset instantly when the user lets go of the input.
@spefyjerbf sorry to keep tagging you about funkytrees, I'm trying to learn
wouldn't something along the lines of smooth(Activate1,delay)>threshold ? 1 : 0 achieve something similar, or is there something else it it?
I covered this, among other topics, extensively in my most recent build's technical documentation. You can find the general formula there. Or, this funky trees code should do what you need it to do:
.
Activate1 * floor(smooth(clamp01(Activate1), Activate1 ? 1 / 5 : pow(10,10) ))
.
Edit: Looks like the code wasn't formatted properly for mobile. Here's the code, again:
Activate1 * floor(smooth(clamp01(Activate1), Activate1 ? 1 / 5 : pow(10,10) ))
You can put two rotators together in different directions with one more range than the other but the same speed, they cancel out until one runs out and the other keeps going. It takes a little fine-tuning, but it's simple and reliable.