Profile image

How do I make something have no delay when I activate it, but have a delay when I deactivate it?

227k jamesPLANESii  3.8 years ago

For a door handle lol

This is short, have a random picture

  • Log in to leave a comment
  • Profile image
    161k spefyjerbf

    @Aarons123 No problem! To change the direction of the bidirectional delay, we invert some of the functions:
    Bool * floor(smooth(clamp01(Bool), Bool ? 1 / delayTime : pow(10,10) ))
    .
    Where:
    Bool = a boolean input. For example, an activation group (Activate1)
    delayTime = your delay time (seconds)
    .
    This delay behaves the way that you would expect a delay to behave. It looks the way it does to allow the smooth function to behave as we want it to.

    Pinned 3.8 years ago
  • Profile image
    161k spefyjerbf

    You use a modified version of something that I call a bidirectional delay function:
    ceil(smooth(clamp01(Bool), Bool ? pow(10, 10) : 1 / delayTime ))
    .
    Where:
    Bool = a boolean input. For example, an activation group (Activate1)
    delayTime = your delay time (seconds)
    .
    This code is the inverse of what I am used to doing, so I'm not sure if it will be right. Let me know if it works. If not, I can edit it as needed. @Aarons123 @jamesPLANESii
    .
    Edit: The first bool was removed as it messed up the delay.

    Pinned 3.8 years ago
  • Profile image

    @spefyjerbf how to make piston movement smoother?

    +1 2.6 years ago
  • Profile image
    161k spefyjerbf

    @DwiAngkasaAeronautics No problem! I’m happy to help

    +1 3.0 years ago
  • Profile image

    @spefyjerbf thanks dude very helpful

    +1 3.0 years ago
  • Profile image
    3,214 Chrisk1993

    @spefyjerbf Thank you so much I've been tearing my hair out trying to make landing gear doors. This code is perfect.

    +1 3.3 years ago
  • Profile image
    16.4k Aarons123

    @jamesPLANESii other rotators I have that work though have it as 0

    3.8 years ago
  • Profile image

    I think activation group set to 0 means that it’s disabled @Aarons123

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf the activationgroup was set as 0, I’m pretty sure that’s default

    3.8 years ago
  • Profile image
    161k spefyjerbf

    @Aarons123 Thats odd. What do you have set as the activation group? Not as the input, but the activationgroup field.

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf I removed it and now the piston doesn’t retract at, I changed the start to this, clamp01 * ceil, with the rest the same

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf I copied the exact formula from your pinned comment and there’s still no delay

    3.8 years ago
  • Profile image
    161k spefyjerbf

    @Aarons123 Ah, I think my code is a little off. Try removing the first activate2, and see what happens.

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf oh sorry it turns out I didn’t read properly as well, I need it to have a delay once Act2 is turned of, but not have a delay once it is turned on. Now this is just getting confusing

    3.8 years ago
  • Profile image
    161k spefyjerbf

    @Aarons123 ah! put a clamp01 around the first Activate2. That should make the delay work upon deactivation. Hopefully, at least.

    3.8 years ago
  • Profile image
    161k spefyjerbf

    @Aarons123 Do you need the delay when you activate, or deactivate?
    EDIT: wait. next time I should read the entire comment. one sec

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf Ik it’s been like 30 years but I’ve tried using the first formula on a piston to do piston things, this is exactly what I put as the input, Activate2 * ceil(smooth(clamp01(Activate2), Activate2 ? pow(10, 10) : 1 / 3 )). I can’t tell what I’ve done wrong but there’s no delay. Thanks for your help again

    3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf thanks, pretty much everything you just said may as well be a different language but I appreciate the help, now my landing gear won’t give up when you extend them

    +1 3.8 years ago
  • Profile image

    Lol, you are saved

    3.8 years ago
  • Profile image

    Life saver :D @spefyjerbf

    +1 3.8 years ago
  • Profile image
    16.4k Aarons123

    @spefyjerbf also thanks, is there anyway to make it do the opposite, delay once activated but no delay when not?

    3.8 years ago
  • Profile image

    Thanks! :D @spefyjerbf

    3.8 years ago
  • Profile image

    Alright so basically

    You just do

    3.8 years ago
  • Profile image
    16.4k Aarons123

    Yes please someone answer this so I can steal it and use it myself

    +3 3.8 years ago