From BeamNG

Revision as of 04:02, 23 December 2015 by Gabester (talk | contribs)

Variables are a new feature introduced in They allow you to change any numeric value in a .jbeam dynamically with the tuning menu in-game.

Example Section

    "variables": [
        ["name", "type", "unit", "category", "default", "min", "max", "title", "description"]
        ["$camber_FR", "range", "", "Alignment", 0.98, 0.95, 1.05, "Front Right Camber", "Percentage of adjustment range"]
        ["$camber_FL", "range", "", "Alignment", 0.98, 0.95, 1.05, "Front Left Camber", "Percentage of adjustment range"]
        ["$trackwidth_F", "range", "m", "Alignment", 0.26, 0.26, 0.29, "Front Track Width", "Widen or narrow the wheel track"]

Most of the options are pretty self-explanatory. The name of the variable must start with the $ character.

There are some additional options not in the header. If a unit is not defined, the variable will default to a range of -100% to 100% (scaled to fit the min/max values set) in the tuning UI. You can change these by setting "minDis" and "maxDis". Variables with units show the raw values. You can use "step" to change the increments in which the variable changes. "stepDis" works the same, but for the scaled percentage value for unitless variables.

Usage Cases

Variables can be used for literally any number in a .jbeam, including node position, weight, spring, damp, deform, precompression, or whatever else you can think of. Simply replace the number with the name of the variable (don't forget quotes).

This is an example of using variables to control camber, in this case the upper arm of the Covet's rear suspension. By precompressing the beam, we change the length of it, thus angling the wheel in or out due to the design of the suspension.

          //camber adjust

An interesting possible use for variables would be to position a part, such as cargo on a roof rack, by replacing the x and y nodeOffset coordinates with variables. You could then position the part in-game anywhere within the predefined range you've set. This concept is used for adjustable track width on all of the cars. The x axis nodeOffset for the wheels is set by the variable.