Components

Components are generic key-value stores that extend/overwrite Jbeam code. They use the Json dictionary syntax. They are an experimental feature in BeamNG update 0.32.

"components": {
    "wheels": {
        "FL": {
            "diameter": 0.56,
            "something": 3,
        },
    },
    "cameras": {
        "MyDefault":{
            "distance":4,
            "distanceMin":3,
            "offset":{"x":0.0, "y":0.0, "z":0.59},
            "fov":65,
        }
    }
}

Components are used in Jbeam via a $>> operator. It points to a data store that will be used for the value.

"cameraExternal":"$>>components.cameras.MyDefault",

Usage

A part can extend or overwrite component data:

/// the main part
    "components": {
        "wheels": {
            "FL": {
                "diameter": 0.56,
                "something": 3,
            },
        },
    }

/// the sub part
    "components": {
        "wheels": {
            "RR": {
                "diameter": 0.1,
                "something": 1,
            },
            "FL": {
                "diameter": 2, // overwrites
                "somethingElse": 3,
            },
        }
    }

Components work not only for table data, but also for modifiers:

"components": {
    "collisionEnabled": true,
},
"nodes" :[
   ["id", "posX", "posY", "posZ"],
   {"collision" :"$>>components.collisionEnabled"},
],

They can be used as table rows:

"components": {
    ["node3", -0.90, -0.93, 0.23],
},
"nodes" :[
   ["id", "posX", "posY", "posZ"],
   ["node1", -0.90, -0.93, 0.23],
   ["node2", -0.33, -0.95, 0.23],
   "$>>components.node3",
   ["node4", 0.90, -0.93, 0.23],
   {"group":""},
],

They can also be used inside of another component which is a table row:

"components": {
    "posZ": 0.23,
    ["node3", -0.90, -0.93, "$>>components.posZ"],
},
"nodes" :[
   ["id", "posX", "posY", "posZ"],
   ["node1", -0.90, -0.93, 0.23],
   ["node2", -0.33, -0.95, 0.23],
   "$>>components.node3",
   ["node4", 0.90, -0.93, 0.23],
   {"group":""},
],

Example

A component could be used to define pressureWheel options, to keep wheels Jbeam clean:

"components": {
    "wheelConfig_FR": {
        "selfCollision":false,
        "collision":true,
        "hubcapBreakGroup":"hubcap_FR",
        "hubcapGroup":"hubcap_FR",
        "axleBeams":["axle_FR"],
        "torqueCoupling:":"ta1",
        "torqueArm:":"tc1",
        "steerAxisUp:":"fh2r",
        "steerAxisDown:":"fh1r",
        //"hubcapBreakGroup":"hubcap_FL",
        //"hubcapGroup":"hubcap_FL",
        //"axleBeams":["axle_FL"],
        "disableMeshBreaking":false,
        "disableTriangleBreaking":false,
        "enableHubcaps":false,
        "enableTireLbeams":false,
        "enableTireSideReinfBeams":false,
        "enableTireReinfBeams":false,
        "enableTreadReinfBeams":false,
        "enableTirePeripheryReinfBeams":false,
        "loadSensitivitySlope":"",
        "noLoadCoef":"",
        "fullLoadCoef":"",
        "frictionCoef":"",
        "slidingFrictionCoef":"",
        "softnessCoef":0.5,
        "treadCoef":1.0,
        "TEST": 123,
    }
}
"pressureWheels":[
    ["name","hubGroup","group","node1:","node2:","nodeS","nodeArm:","wheelDir"],
    //front
    ["FR", "wheel_FR", "tire_FR", "fw1rr", "fw1r", 9999, "fh5r", 1, "$>>components.wheelConfig_FR"],
],
Last modified: 16/4/2024 14:55
On this page:

Any further questions?

Join our discord