Profile image

Need funky trees help for a hingerotator that goes 2 directions 2 w/ 1 input

465 Fanboyfast  5 months ago

So I have a cover for an arresting hook that opens to get out of the way for the hook and then closes partially for aerodynamics and so it isn’t between the wire and hook, and when in flight, opens to let the hook in and then closes completely.

The code I have come up with so far:

Activate1 ? clamp(smooth(clamp(2,2,2),-0.5),0.5,2) : clamp(smooth(clamp(2,2,2),-0.5),0,2)

This mostly works as intended, the problem is I can only use it once. I assume that it is because when the rate gets the angle to 0.5 and 0 respectively it saves that position instead of resetting when I toggle act 1. So is there a way I can get it to reset? Or a way to approach this completely differently?

P.S. the “clamp(2,2,2)” were an attempt to get it to reset, but 2 does the same thing.

  • Log in to leave a comment
  • Profile image

    Nice
    Anyways, I just call it animation-style, there's no such term for it. Not exactly the same as your code though, here's an example I digged up from one of my planes
    .
    Wheel assembly: lerp(0, 1, inverselerp(0, 9, smooth(GearDown?0:10,1))
    .
    Main door: lerp(1, 0, inverselerp(5, 10, smooth(GearDown?0:10,1))
    .
    I'm using a code structure I call a linear map

    5 months ago
  • Profile image

    @hpgbproductions Thank you so much! I actually got it working using those timers you mentioned.

    My code:
    Rotator input: Activate1 ? clamp(x,0.5,2) : clamp(x,0,2)
    A: smooth(Activate1?0:10, 5)
    B: smooth(Activate1?0:10, -5)
    C: smooth(Activate?10:0, 5)
    x: Activate1 ? max(A,B) : C

    Maybe not the most optimized, but it is the most advanced funky trees I’ve done and it works flawlessly for the context I need it for.

    5 months ago
  • Profile image

    @hpgbproductions So my Idea with the clamp is that if min=max=val that the value couldn’t decrease below minimum. Is this animation functionality for funky trees in with the normal overload mod?

    5 months ago
  • Profile image

    I use an animation software style of funky trees for most timed animations. It is based around a timer variable, e.g., smooth(GearDown?0:10, 1).
    Each rotator will have an input which is basically in the form x(t), or x varies with the timer above.
    If your animation is the same (but reversed obviously) on activation and deactivation, this method is very easy to write and edit

    5 months ago
  • Profile image

    Since the first argument of your smooth functions are constants, each smooth function will only perform one movement each, as soon as it is chosen by the ternary operator. You need a way to reset the smooth functions.
    Also, clamp(val,min,max) clamps val between min and max. Since min=max, val=min=max

    5 months ago