Flexbodies

Flexbodies are the models that get mapped to your nodes, and have deformation applied to them.

The game will calculate deformation by mapping every vertice to the nearby nodes, and moving them accordingly with the movemement of those nodes.

Flexbodies are assigned to a set of nodes using nodegroups, with the flexbodies only getting deformed by the movement of those specific nodes. See the nodes page for more information.

All the meshes should be in one or multiple dae files either in your car’s folder or the common folder. See the vehicle modelling page for more information.

Deform groups

An additional feature that can be used are deform groups. Those allow you to trigger a material change on a model when a defined set of beams get deformed. They are commonly used for lights and windows.

Required arguments

"flexbodies" :[
    ["mesh", "[group]:","nonFlexMaterials"],
    ["my_mesh", ["my_group"]],
],
string
type
Defines the name of the mesh
This is the same name as in blender.
string
type
Defines the id of the node group this mesh is linked to
A mesh can be linked to multiple node groups. For more information about groups, see the nodes page.

“nonFlexMaterials” is a deprecated legacy feature that is not used or usable anymore. It was used with the old tire model to prevent the rigid wheel mesh from compressing with the tire.

Optional arguments

dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Position offset of the flexbody
"pos":{"x":0.0, "y":0.0, "z":0.0}
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Rotation offset of the flexbody

Uses the intrinsic Euler +Z +X +Y rotation system.

"rot":{"x":0.0, "y":0.0, "z":0.0}
dictionary
type
{“x”:1, “y”:1, “z”:1}
default
Scale offset of the flexbody
"scale":{"x":1.0, "y":1.0, "z":1.0}
string
type
Defines the deform group that will be used for this mesh
This name should match the deform group defined in the beams section.
string
type
The name of the initial material that will get changed
Any mesh that has a deform group applied should have only a single material to avoid issues. This can require separating parts into multiple components, like separating the lens and reflector on a headlight.
string
type
The name of the material to use when the break group is triggered
string
type
The sound clip that will be played when the deform group is triggered
number
type
The volume of the sound clip that is played when the deform group is triggered
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Offsets the mesh on the YZ axis, and offsets it in a mirrored fashion on the X axis if the position is not centered on it
This is never set explicitly in Flexbodies section but rather passed from the Slots section.
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Offsets the mesh on the XYZ axis
This is never set explicitly in Flexbodies section but rather passed from the Slots section.
boolean
type
false
default
Whether the position of the mesh should ignore the nodeOffset modifier
table
type
Replaces a defined set of materials used by the flexbody by a different set of materials

Example usage:

["part", ["group"], [],{"materialOverride":[
    ["originalMaterial1","replacementMaterial1"], 
    ["originalMaterial2","replacementMaterial2"]
]}],

Simple Example

A mesh called “my_mesh” is assigned to nodes in group “my_group”.

"flexbodies" :[
    ["mesh", "[group]:","nonFlexMaterials"],
    ["my_mesh", ["my_group"]],
],

Advanced Example

An example of headlights with deform groups.

   "flexbodies": [
         ["mesh", "[group]:", "nonFlexMaterials"],
         ["pickup_headlightframe_R", ["pickup_fascia"]],
         ////lights
         {"deformGroup":"headlightglass_R_break", "deformMaterialBase":"gavril_lights", "deformMaterialDamaged":"gavril_lights_dmg"},
         ["pickup_headlight_R", ["pickup_fascia"]],
         //glass
         {"deformGroup":"headlightglass_R_break", "deformMaterialBase":"pickup_glass", "deformMaterialDamaged":"pickup_glass_dmg"},
         ["pickup_headlightglass_R", ["pickup_fascia"],[]{"deformSound":"event:>Destruction>Vehicle>Glass>glassbreaksound4", "deformVolume":0.6}],
         {"deformGroup":""},
    ],

An example of a flexbody using modifiers and multiple node groups.

    "flexbodies": [
        ["mesh", "[group]:", "nonFlexMaterials"],
        //wheels
        ["steelwheel_10a_13x5_5", ["wheel_FR","wheelhub_FR"], [], {"pos":{"x": -0.50, "y":-0.0, "z":0.0}, "rot":{"x":0, "y":0, "z":180}, "scale":{"x":1, "y":1, "z":1}}],
        ["steelwheel_10a_13x5_5", ["wheel_FL","wheelhub_FL"], [], {"pos":{"x": 0.50, "y":-0.0, "z":0.0}, "rot":{"x":0, "y":0, "z":0},    "scale":{"x":1, "y":1, "z":1}}],
    ],

Using materialOverride to define multiple parts with different color variants.

"us_semi_conventional_bullbar_type_bare": {
    "information":{
        "authors":"BeamNG",
        "name":"Bare Metal",
        "value":450,
    },
    "slotType" : "us_semi_conventional_bullbar_type",
   "flexbodies": [
       ["mesh", "[group]:", "nonFlexMaterials"],
       ["longnose_bullbar", ["us_semi_bullbar"], [],{"materialOverride":[["us_semi_common","us_semi_common"]]}],
   ],
},
"us_semi_conventional_bullbar_type_chrome": {
    "information":{
        "authors":"BeamNG",
        "name":"Polished",
        "value":450,
    },
    "slotType" : "us_semi_conventional_bullbar_type",
   "flexbodies": [
       ["mesh", "[group]:", "nonFlexMaterials"],
       ["longnose_bullbar", ["us_semi_bullbar"], [],{"materialOverride":[["us_semi_common","us_semi_common_chrome"]]}],
   ],
},
"us_semi_conventional_bullbar_type_painted": {
    "information":{
        "authors":"BeamNG",
        "name":"Painted",
        "value":450,
    },
    "slotType" : "us_semi_conventional_bullbar_type",
   "flexbodies": [
       ["mesh", "[group]:", "nonFlexMaterials"],
       ["longnose_bullbar", ["us_semi_bullbar"], [],{"materialOverride":[["us_semi_common","us_semi_common_painted"]]}],
   ],
},
"us_semi_conventional_bullbar_type_black": {
    "information":{
        "authors":"BeamNG",
        "name":"Black",
        "value":450,
    },
    "slotType" : "us_semi_conventional_bullbar_type",
   "flexbodies": [
       ["mesh", "[group]:", "nonFlexMaterials"],
       ["longnose_bullbar", ["us_semi_bullbar"], [],{"materialOverride":[["us_semi_common","us_semi_common_black"]]}],
   ],
},
Last modified: 16/4/2024 14:55

Any further questions?

Join our discord