My Jbeam/Json Questions Thread

Discussion in 'Content Creation' started by KennyWah, Dec 9, 2022.

  1. KennyWah

    KennyWah
    Expand Collapse

    Joined:
    Jan 16, 2013
    Messages:
    2,666
    So, my question is as follows.

    if I want a tuning option that creates a specific value, but I want an option which adds a modifier to said value when toggled on, how would I do that?

    I basically need "$=$value1 + 0.25 * $value2"

    so if we call Value1 "A" and Value2 "B"

    I need A = A +(0.25 x B)

    so if B = 1 then it'll add 0.25 to A but if B = 0 then the Value of A = A unchanged.
    I want to do this without accidently making A = 0

    How can I self contain that in Json/Jbeam?



    Please ignore the odd use of uppercase on the "$Tuning" variable.
     
    #1 KennyWah, Dec 9, 2022
    Last edited: Dec 10, 2022
  2. floz

    floz
    Expand Collapse

    Joined:
    Jan 13, 2019
    Messages:
    19
    according to
    https://documentation.beamng.com/modding/vehicle/sections/variables/ :

    When using the variable inside a function, it will once again replace the number you’d use there usually. The function should start with $=. The entire function should be in quotation marks. See the example bellow for a case of using a function to adjust the Y coordinate of a node.

    ["fh2r", -0.65, "$=$caster_F*0.00175-1.2", 0.32],

    It is very important to use the “$=Function” syntax, or else the parser won’t calculate the function correctly.

    ---however it doesn't say anything about multiple operations in a single $=Function call.
    I cannot test atm, but you might try creating a temp variable:

    $valueTemp:"$=value1 + 0.25"

    $value1:"$=valueTemp * value2"
     
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,445
    "$=case(($value1 + 0.25 * $value2)==0, $value1 + 0.25 * $value2, $value1)"
    I believe this will work but the way you worded the message is very confusing so idk if that is what you need
     
  4. KennyWah

    KennyWah
    Expand Collapse

    Joined:
    Jan 16, 2013
    Messages:
    2,666
    That's fine, I don't really particularly need it anymore.
     
  5. KennyWah

    KennyWah
    Expand Collapse

    Joined:
    Jan 16, 2013
    Messages:
    2,666
    -

    Another question.

    I cannot find this in BeamNG's documentation on Jbeam

    But if you don't specify a value for "dampCutoffHz" does it just default to 2000hz? (physics engine max?)

    Or what is the default value? 1000hz?
     
    #5 KennyWah, Dec 11, 2022
    Last edited: Dec 11, 2022
  6. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,445
    The default value is 0
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice