From BeamNG

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

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.



Common variable arguments

Name Type Optional Default Value Description
name string NOk n/a The name of the variable, used within the jbeam file.
type string NOk n/a Type of this variable. Only currently supported type is "range".
unit string Ok % Unit displayed in UI for this variable.
category string Ok alignment Defines the category this variable falls under in the UI.
subCategory string Ok n/a Subcategory, displayed within category.
default float NOk n/a Default variable value.
title string Ok n/a Title of this variable, for displayed in UI.
description string Ok n/a Description of variable, shown when mouse is hovered in UI.

Range variable arguments

Name Type Optional Default Value Description
min float NOk n/a Lowest possible variable value
max float NOk n/a Highest possible variable value.
minDis float Ok -100 Lowest displayed value of the variable.
maxDis float Ok 100 Highest displayed value of the variable.
stepDis float Ok 1 Sets the minimum amount of increment/decrement needed to change the variable value.

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.


You're not limited to just the value of your variable when using it in jbeam. You can also combine your value with expressions. note that instead of starting with $, we now start with $=.

          //camber adjust
          ["rx3r","rh3r"{"beamPrecompression":"$=$camber_RR * 1.1"}],
          ["rx3l","rh3l"{"beamPrecompression":"$=$camber_RL * 1.1"}],

You may also use basic math functions such as min, max, cos, etc.