Przejdź do głównej zawartości

Szukaj

Controller Sensor Stick to calculator (Bug?)

  • TheBeardyMan

    The "sticks" fat wire type that you get from the Controller Sensor's left stick output is one of the fat wire types that the Calculator handles as a vector, even when the other input is a scalar.

    In your case, when you push the stick in a direction that corresponds to scene space positive X or scene space positive Z (or right or down when you're using one of the "local sticks" outputs), you get the vector [1.0, 0.0] or [0.0, 1.0]. When a calculator compares that to the scalar 0.95 using operation >, it outputs the vector [1.0, 0.0] or [0.0, 1.0], and when that vector is received by something that expects a scalar, it's converted to the vector's magnitude, which is 1.0 - a true value.

    But when you push the stick in a different direction - say, a diagonal - you get a vector like [0.707, 0.707], and when the Calculator compares that to the scalar 0.95 with the operation >, it outputs the vector [0.0, 0.0], and when that vector is received by something that expects a scalar, it's converted to the vector's magnitude, which is 0.0 - a false value.

    You want the > 0.95 comparison to be comparing with the magnitude of the vector, not the individual vector components, and you can do this by setting the A input of the calculator to 1.0 and setting the input's blend mode to modulate. That forces the Calculator's A input to convert the vector to a scalar before performing the comparison, and you should get the results that you were expecting - a true value when the stick is fully tilted.

  • TAPgiles
    Great answers

    (nods at BeardyMan)

    No bug, it's working as designed. I have tutorials on their way about how this stuff works, but they're on patreon.com/tapgiles only right now.

  • Magawaan

    Thanks for your replies everyone!

    @TheBeardyMan I can't say that I fully understood the issue, but I used your suggestion in my creation.Guess you can connect stuff the "wrong" way if vectors and scalar input/output collide? Sounds like an intersting theme to learn more about.

Zaloguj się, aby dodać komentarz.