Profile image

How do we make input delays?

2,376 TheKraken3  4.1 years ago

I saw this on landing gear doors on ChiChiWerx's F-20 but I can't figure it out, can someone please help?

Delayed inputs are useful for sooooo much stuff, landing gear doors is the main one

I'm thinking of maybe making a railgun somehow by using magnets that turn on and off to propel a metal shell, all of this would use DELAYS

  • Log in to leave a comment
  • Profile image
    15 GMen

    Ini dapat di gunakan dengan funky trees masukkan code floor(smooth(clamp01(LandingGear), 0.5))

    +1 3.2 years ago
  • Profile image

    @vcharng Thanks! this really helped! I can now do doors and cool stuff! Thanks you so much!

    3.4 years ago
  • Profile image
    7,397 FeiWu

    @vcharng oh ok

    3.4 years ago
  • Profile image
    9,428 vcharng

    Oh by the way, if your landing gear "will stop at halfway" then you definitely set the wrong zero.
    landing gears have always been a 0-1 stuff (either by setting the max as 1 and min as 0, or by using clamp functions), if any one of your component requires a full 1~-1 to work ,that can only mean on thing: that component is zeroed at halfways, which nobody does.

    3.4 years ago
  • Profile image
    9,428 vcharng

    @FeiWu No, my original post was coded with LandingGear command and if it works with GearDown that'll be a miracle.
    The article was written right before GearDown even existed, and they have only barely changed the old LandingGear command back to give it some backward compatibility (at my request!).
    There is no guarantee that they didn't make further changes afterwards and I will not make changes to my (possibly outdated) post for this.

    3.4 years ago
  • Profile image
    7,397 FeiWu

    @vcharng no. It's not just that it will be backwards. You mistakenly wrote LandingGear instead of GearDown. Not only is it reversed, if you actually use LandingGear and have your code for the modern gear retraction the gear will actually only retract halfway. Plus, you said yourself that LandingGear is 1 when extended and -1 when retracted. In reality, LandingGear is 1 when retracted and 0 when retracted. What you said is true for (and what your code works for) is GearDown which is 1 when extended and -1 when retracted.

    3.4 years ago
  • Profile image
    9,428 vcharng

    @FeiWu GearDown and LandingGear is different.
    GearDown is 1 when gear is down, LandingGear is -1.
    in my post I was using LandingGear, if you use GearDown it will be reversed, though after a few adjustment you should be able to make it work.

    3.4 years ago
  • Profile image
    7,397 FeiWu

    @vcharng after reading your instructions, I realized after three hours you meant GearDown instead of LandingGear
    please change it.

    3.4 years ago
  • Profile image
    569 Ja380

    @TheKraken3 haha my bad man. Will do from now on...

    4.1 years ago
  • Profile image
    9,428 vcharng

    @Ja380 That's what he said, so put any further questions on my landing gear demonstrator page.

    4.1 years ago
  • Profile image
    2,376 TheKraken3

    @vcharng @Ja380 hey can you two discuss on an unlisted build? i don't want more notifications pls

    4.1 years ago
  • Profile image
    9,428 vcharng

    @Ja380 if you want to lengthen the whole process change the number in the smooth function.
    smooth(LandingGear, 0.25) <<<<<change that 0.25 into something smaller to reduce speed.

    4.1 years ago
  • Profile image
    569 Ja380

    @vcharng I just downloaded it and it was what I was looking for so thanks for that. The issue is that they open for a too short amount of time (about 2 seconds) whereas I need them to open for 6 seconds before closing. How do I change the input function to do so? Thanks for the help and prompt replies as always!

    4.1 years ago
  • Profile image
    9,428 vcharng

    @Ja380 Check my landing gear demonstrators. the left side landing gear fits your need.

    4.1 years ago
  • Profile image
    569 Ja380

    @vcharng hello again, recently I wanted to add another set of doors for my front landing gear. I’m not sure if you are familiar with most airliner landing gear doors, but the ones I am talking about usually behave like so:

    They stay closed all of the time and only open up when the front landing gear is being retracted and then close up again (and vice versa). These doors make up 2 of the 4 doors that are used for the front landing gear of most aircraft.

    Is there any possible way to add an input function that will make landing gear doors stay closed and only open up for 6 seconds and close back again?

    Thanks for your help, time, and effort!!

    4.1 years ago
  • Profile image
    569 Ja380

    @vcharng yea I noticed that my gear doors weren’t closing all the way haha...I’ll debug the rotators if anything comes up but I just wanted to thank you for your help once again. Cheers!

    4.1 years ago
  • Profile image
    9,428 vcharng

    @Ja380
    try this:
    clamp01(smooth(LandingGear, (1 / 11)) * 2) for LG
    clamp01((smooth(LandingGear, (1 / 11)) - 0.5) * 2) for door.
    I tried the earlier input myself and find out it needs a *2 to make sure it makes a full stroke. But you can adjust it with angles.

    these are just reference, please debug it yourself.

    and yes, we use smooth function to govern the rotator speed, so set rotator speed to 100% to prevent over-limiting it.

    +4 4.1 years ago
  • Profile image
    569 Ja380

    @vcharng it works well so I appreciate your help! However, I’d like the doors to take 3 seconds to close so how would my input change based on that? Also do the LG door rotators need to be set to 100% speed as well? Sorry for the hassle :)

    4.1 years ago
  • Profile image
    9,428 vcharng

    @Ja380 You did not specify how long you want the door to close, I will assume it's also 8 seconds.
    clamp01(smooth(LandingGear, 0.0625) * 2) for landing gear (set rotator speed to 100%)
    clamp01(smooth(LandingGear, 0.0625) - 0.5) for door.

    try it, I can't verify if it would work with just typing...

    +1 4.1 years ago
  • Profile image
    569 Ja380

    @vcharng thanks for the explanation. In my case, the landing gear takes about 8 seconds to retract fully, so I am looking to get my LG door rotators to start after the 8 seconds. How would I modify the input function for the rotators to do so? And do the landing gear rotator and LG door rotators have to be on the same speed setting for this to work?

    4.1 years ago
  • Profile image
    2,376 TheKraken3

    @vcharng dang it my gun isn't possible?
    thanks for the guide

    4.1 years ago
  • Profile image
    9,428 vcharng

    OK, perhaps I'll write a separate article about this, but basically it's like this:
    Smooth function makes a variable go from the "start value" to "end value" smoothly, rather than instantaneously.
    Without smooth function, LandingGear would go from 0 to 1 instantly, but with smooth, it will go from 0, 0.1, 0.2..... all the way to 1. This progress is continuous, so every value between 0 and 1 will be covered.

    For landing gear doors, it would be like this:

    First, write down the sequence you want.
    for example:
    Gear retraction for 1 second, then door close for 1 second.
    for this you need to go from 0 to 1 in two seconds.
    Therefore you need this function:
    smooth(LandingGear, 0.5)
    in other words the function follows the LandingGear input, but only changes 0.5 per second, therefore taking 2 seconds to go all the way to 1.

    Then, you need to tweak your rotaters so that the landing gear rotator operates from 0 to 0.5, and door operates from 0.5 to 1.
    For this case:
    LG rotator:
    min 0
    max 1
    angle your discretion (usually 90)
    input:
    clamp01(smooth(LandingGear, 0.5) * 2)

    Door rotator:
    Input:
    clamp01(smooth(LandingGear - 0.5, 0.5) * 2)
    (others are the same)

    As for railgun, what you describe is not a railgun, but a coil gun ("gauss rifle" in sci-fi nomenclature)
    The accurate timing was proven impossible even IRL, let alone in SP's imperfect physics.

    +9 4.1 years ago