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"]],
],
mesh
name
string
type
Defines the name of the mesh
This is the same name as in blender.
group
name
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

pos
name
float3
type
0,0,0
default
Position offset of the flexbody
"pos":{"x":0.0, "y":0.0, "z":0.0}
rot
name
float3
type
0,0,0
default
Rotation offset of the flexbody
"rot":{"x":0.0, "y":0.0, "z":0.0}
scale
name
float3
type
1,1,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
boolean
type
false
default
Enables mesh breaking
Mesh breaking allows polygons of a flexbody mesh to be dynamically removed when an underlying beam breaks. This can be used to avoid excessive stretching of meshes when part of its assigned jbeam structure breaks free.

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}}],
    ],
Last modified: 28 November 2021, at 22:06

Any further questions?

Join our discord