Profile image

FT Stabilizer Weirdness

95.1k ReinMcDeer  2.8 years ago

I made a FT horizontal stabilizer for my Abrams, but it has this weird flaw I can't seem to fix.

Here's the spaghetti:

sum((Roll*(Activate3=true ? .05 : .75)-clamp((Activate2=true & Roll = 0 ? smooth(YawRate, Activate2=true ? 1 : 0) : 0), -.5, .5))

Activate2 toggles the stabilizer and Activate3 is a slow mode for turret traverse (Activate3 is not really relevant here, though.) It should also be noted that the cockpit is part of the turret. (Ergo, it spins with it.)

The bolded part is where I suspect the problem is, since when I used DebugExpression, it kept increasing/decreasing in the situation described below.

If I turn the hull with the stabilizer OFF, when I the stabilizer ON, the turret starts spinning in the opposite direction. Eventually, it stops spinning and the stabilizer starts working as normal. And the amount it spins seems to be proportional to how fast the hull was turning (YawRate).

But, what's strange is that if I try to repeat this, this spinning problem doesn't happen. If I restart, it will happen again, but if I try again in the same play session, everything works as normal after the spinning.

Can someone tell me what might be going on?

  • Log in to leave a comment
  • Profile image
    95.1k ReinMcDeer

    Temporary fix currently is to have Activate2=false, since having the stabilizer on at the start prevents this issue.

    Pinned 2.8 years ago
  • Profile image
    95.1k ReinMcDeer

    @hpgbproductions I would, but I still have no idea how they work :p

    2.8 years ago
  • Profile image

    Could be because memory functions like smooth() aren't evaluated if the ternary function doesn't reach it
    Maybe try using smooth() in a variable

    2.8 years ago
  • Profile image
    95.1k ReinMcDeer

    @rexzion yeah thats a good idea actually, rate(Heading) is a thing

    2.8 years ago
  • Profile image
    44.3k rexzion

    you should prob use Heading instead of YawRate but idk i dint look at your code in detail jus sayig

    2.8 years ago
  • Profile image
    95.1k ReinMcDeer

    @edensk Now that I think about it, the second Activate2=true is probably unnecessary

    2.8 years ago
  • Profile image
    16.5k edensk

    this won't fix it, but you can delete the =true bits to make the code simpler

    2.8 years ago