Profile image

Multiple Inputs on Rotators Not Working

0 Prokuplanes  one month ago

hey yall,

first, sorry if i wrote too much, this is my first post...

(skip this) so, im making a tiny military cargo plane. the cargo bay door consists of two doors, one that opens down as a ramp and one that opens up for space to load cargo or wtv. i had an idea to add a turret in the back that can be used with the top door open.

(skip this?) at first, the ramp and top door were set to AG4, and it worked fine. then, i set the top door's hinge rotators input to "Activate4+TargetSelected," but it wouldn't open with with either input independently (both AG4 and a target was needed to open the door, and if these were activated, it opened the door twice as wide). then i set the input to "Activate4+TargetSelected*2" and it would open when a target was selected, but not when AG4 was activated.

bascially, i need a hinge rotator input that allows it to open when AG4 is activated, OR when a target is selected.

thx a lot!

  • Log in to leave a comment
  • Profile image
    66.2k PlaneFlightX

    @Prokuplanes Actually, looking back, mine is a bit much. I forgot that | (OR operator) will output 1 if either of the Booleans is true, so the output of Bool | Bool will be -1 or 1. Having "off" being -1 tends to mess up stuff, especially more complicated codes, so I like to put clamp01s to make it 0 or 1. So my final recommendation would be to just clamp01 everything: clamp01(Activate4 | TargetSelected), although if whatever your use case is disregards the -1, then the simpler one is also fine.

    +1 one month ago
  • Profile image

    @PlaneFlightX the other comment said to use "|" isntead of "+," which worked. I tried your rec too and that worked as well. is there a difference between the two? if there isn't it seems like the first solution is better since its simpler. thx tho!

    one month ago
  • Profile image

    @OverlordPrime thx, i tried this and it worked!

    +1 one month ago
  • Profile image
    66.2k PlaneFlightX

    Activate4 is a Boolean, meaning it is True or False. Number-wise, this gets converted to -1 (off/False) or 1 (on/True). I recommend clamp01clamp01(Activate4) + clamp01(TargetSelected)). The clamp01s on the two inputs ensure the numbers are either 0 or 1, and the clamp01 around the entire expression ensures the input is either 0 or 1.

    +2 one month ago
  • Profile image

    Instead of "+", use "|"

    +1 one month ago