Slots

The slot and slotType sections are used to define where a component fit’s within the vehicle’s parts tree. For more information on the basics of the parts and component system, you can read the introduction to the part/slot system

Each part also has a “slotType”, which identifies where in the vehicle it fits, and allowing multiple parts to act as alternatives to each other. One unique slot type is “main”, which refers to the “root”" component of the vehicle.

The slots section defines which components are the “children” of that component based on their slotType.

You can use the optional arguments in Slots section to pass arguments to all the sections in the chosen part (and all of their child parts, provided that the value is not changed by them). This is commonly used with the nodeOffset and nodeMove arguments, which apply offsets to nodes, flexbodies and props, effectively moving the part installed in the target slot by a set distance.

Starting in update 0.32, you can pass values of variables to a slot via the Slots section. This mechanism is called Slot Variables. The values will be passed to the part equipped in the slot and all of its child parts. They will work the same way as variable values set in the Tuning menu, but they will not be editable by the user. String values can also be passed, and then concatenated with other strings, for example as node name prefixes. Boolean values also work, which combined with the Disable Modifier allows you to toggle sections of Jbeam on and off depending on the slot the part is in. This allows for making components that are easier to reuse, as instead of making a few separate variants with small changes, the changes can be controlled by variables.

SlotType

Required argument

string/table
type
The slot type, or list of slot types, of the component
In almost all cases, this will be a string identical to the type of a slot in the parent component. However, it can also be a table specifying multiple slot types the part fits in.

Slots

Required arguments

string
type
The internal name of the slot
The parts in that slot should have this value as their slottype
string
type
The component that gets loaded by default if no part is defined in the car’s config file

string
type
type
default
The name of the slot in the part selector

Optional arguments

boolean
type
If enabled, the choice to have the part empty is removed from the part selector/garage
dictionary
type
Contains variable names as dictionary keys, and their values as dictionary values

Variable names must start with the $ symbol. Example usage:

["log_trailer_bolsters_R","log_trailer_bolsters_R","Rear Bolsters", {"variables": {"$bolster_offset":-0.39}}],

Commonly passed arguments

These are arguments of Nodes, Flexbodies and Props sections, that are almost exclusively used as optional arguments in Slots section to pass their values to those. They affect the part in question and all its child parts until the value is reset back to 0.

dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Offsets all the nodes, flexbodies and props on the YZ axis, and offsets nodes, flexbodies and props in a mirrored fashion on the X axis (m)

Mostly interchangeable with nodeMove. Mostly required when it comes to wheels, where the X offset will move the nodes, flexbodies and props on each side equally further/close appart from the centerline. For flexbodies, the center is determined as having a 0 value on X axis in the “pos” argument, which is the default. This means that nodeOffset will not work correctly on flexbodies that have no set pos argument.

You cannot use nodeOffset if one of the slots of the component you’re offsetting has a nodeOffset, as the second one will overwrite the first one. In this sort of application, you’ll have to use nodeMove on either component.

dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Offsets all the nodes, flexbodies and props on the XYZ axis (m)

Mostly interchangeable with nodeOffset. This modifier will translate the nodes, flexbodies and props to the left or right on the X axis, and not move them in a mirrored fashion.

You cannot use nodeMove if one of the slots of the component you’re offsetting has a nodeMove, as the second one will overwrite the first one. In this sort of application, you’ll have to use nodeOffset on either component.

Simple Example

A component with only a single slot with no modifiers.

"autobello_spring_F": {
    "slotType":"autobello_spring_F",
    "slots":[
        ["type", "default", "description"],
        ["autobello_shock_F","autobello_shock_F", "Front Shocks"],
    ],
},

Advanced Example

Component with multiple slot types.

"semi_R_suspension_single_leaf": {
    "slotType" : ["us_semi_suspension_R_single","us_semi_suspension_R_tandem"],
},

Chassis jbeam that makes use of both nodeOffset and nodeMove.

"pickup_frame_ext":
{
    "slotType" :"pickup_frame",
    "slots":[
        ["type", "default", "description"],
        //running gear
        ["pickup_ABS","pickup_ABS", "Anti-Lock Braking System"],
        ["pickup_ESC","", "Electronic Stability & Traction Control"],
        ["pickup_fueltank","pickup_fueltank","Fuel Tank", {"nodeOffset":{"x":0.0,"y":0.613,"z":0}}],
        ["pickup_engine","pickup_engine_v8_4.5","Engine"],
        ["pickup_muffler_ext","pickup_muffler_ext","Muffler"],
        ["pickup_suspension_R","pickup_axle_R","Rear Suspension", {"nodeMove":{"x":0.0,"y":0.613,"z":0}}],
        ["pickup_suspension_F","pickup_IFS","Front Suspension"],
        ["pickup_driveshaft_R_ext","pickup_driveshaft_R_ext","Rear Driveshaft"],
        ////bodywork
        ["pickup_radsupport", "pickup_radsupport", "Radiator Support", {"nodeOffset":{"x":0.0,"y":0.0,  "z":0}}],
        ["pickup_bumper_F","pickup_bumper_F","Front Bumper",           {"nodeOffset":{"x":0.0,"y":0.0,  "z":0}}],
        ["pickup_bumper_R","pickup_bumper_R","Rear Bumper",            {"nodeOffset":{"x":0.0,"y":0.613,"z":0}}],
        ["pickup_body_ext","pickup_body_ext","Body",                   {"nodeOffset":{"x":0.0,"y":0.0,  "z":0}}],
        ["pickup_bed","pickup_bed","Bed",                              {"nodeOffset":{"x":0.0,"y":0.613,"z":0}}],
        //misc
        ["pickup_towhitch","","Tow Hitch", {"nodeOffset":{"x":0.0,"y":0.613,"z":0}}],
        ["pickup_sparetire","pickup_sparetire_6l","Spare Tire", {"nodeOffset":{"x":0.0,"y":0.663,"z":0}}],
        ["linelock", "", "Brake Line Lock"],
        ["pickup_reversewarn", "", "Reverse Warning Beeper"],
    ],
},

Suspension component using nodeoffset with variables, along with a core slot.

"vivace_suspension_R": {
    "slotType" : "vivace_suspension_R",
    "slots": [
        ["type", "default", "description"],
        ["vivace_brake_R","vivace_brake_R", "Rear Brakes"],
        //To change the base track width, edit the trackoffset_R offset in the expression.
        ["wheel_R_5","steelwheel_16a_16x7_R","Rear Wheels", {"nodeOffset":{"x":"$=$trackoffset_R+0.3", "y":1.338, "z":0.32}}],
        ["vivace_wheeldata_R","vivace_wheeldata_R", "Rear Spindles", {"coreSlot":true}],
        ["vivace_spring_R","vivace_spring_R", "Rear Springs"],
        ["vivace_shock_R","vivace_shock_R", "Rear Shocks"],
    ],
},

Passing a slot variable.

"slots": [
    ["type", "default", "description"],
    ["log_trailer_headache_rack","","Headache Rack"],
    ["log_trailer_bolsters_F","log_trailer_bolsters_F","Front Bolsters"],
    ["log_trailer_bolsters_R","log_trailer_bolsters_R","Rear Bolsters", {"variables": {"$bolster_offset":-0.39}}],
],

Using the slot variable in the part the variable was passed to.

"log_trailer_bolsters_R": {
    "information":{
        "authors":"BeamNG",
        "name":"Rear Bolsters",
        "value":500,
    },
    "slotType" : "log_trailer_bolsters_R",
    "flexbodies": [
         ["mesh", "[group]:", "nonFlexMaterials"],
         ["log_trailer_bolster_mount", ["log_trailer_frame"], [], {"pos":{"x":0,"y":5.14,"z":-0.22}}],
         ["log_trailer_bolster_mount", ["log_trailer_frame"], [], {"pos":{"x":0,"y":"$=8.425+$bolster_offset","z":-0.22}}],
         ["log_trailer_bolster", ["log_trailer_bolster_3"], [], {"pos":{"x":0,"y":5.14,"z":-0.22}}],
         ["log_trailer_bolster", ["log_trailer_bolster_4"], [], {"pos":{"x":0,"y":"$=8.425+$bolster_offset","z":-0.22}}],
    ],
],
Last modified: July 10, 2024

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.