Flexbodies

Flexbodies

From BeamNG

Revision as of 00:19, 4 November 2019 by Toron Beldevar (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Flexbodies are the meshes that are mapped to your nodes. Without them, there's nothing to look at.

The parameters are very simple: the name of the mesh (there may be multiple meshes within a .DAE file), and the group(s) it should map to. DeformGroups can be applied to flexbodies to utilize the material switching system, for things like breaking glass and lights.

Flexbodies Example

	"flexbodies": [
		 ["mesh", "[group]:","nonFlexMaterials"],
		 //Mesh name, group it belongs to

		 ["my_mesh", ["my_group"]],
	],

For the above example, the object named "my_mesh" in your DAE file will be mapped to the nodes in the group of "my_group". See the Nodes page for an example of how to create a node group.

Please note, "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.

Multi DAE

BeamNG.drive now supports multiple model files per vehicle(as of version 0.3.5.0), meaning meshes for vehicle mods can now be provided inside an additional DAE file, without the need to change the original DAE file. Syntax for adding flexbodies from additional DAE files is identical to single-DAE flexbody usage.

Applications

Wheels and tires are no longer in the vehicles model file, they are all located in vehicles/common. This now means it is possible to put off-road tires on the Ibishu Covet without ever needing to edit the model, or enlarge the wheels by changing a few values for example. Other uses of Multi-DAE include adding custom parts to the stock vehicles, by creating a new DAE file containing the new meshes. This should be placed adjacent to the existing DAE file.

Offset and positioning

Below is an example using the wheels in vehicles/common with an adjusted position to match the JBeam.

	
	"flexbodies": [
		 ["mesh", "[group]:", "nonFlexMaterials"],
		 //Rims
		 ["offroadwheel_01a_17x9", ["wheel_FR","wheelhub_a_FR","wheelhub_b_FR"], [], {"pos":{"x":-0.8375, "y":-1.463, "z":0.46}, "rot":{"x":0, "y":0, "z":180}, "scale":{"x":1, "y":1, "z":1}}],
		 ["offroadwheel_01a_17x9", ["wheel_FL","wheelhub_a_FL","wheelhub_b_FL"], [], {"pos":{"x": 0.8375, "y":-1.463, "z":0.46}, "rot":{"x":0, "y":0, "z":0}, "scale":{"x":1, "y":1, "z":1}}],
		 //Tires
		 ["offroadtire_01a_17x9_33", ["wheel_FR","wheelhub_a_FR","wheelhub_b_FR"], [], {"pos":{"x":-0.8375, "y":-1.463, "z":0.46}, "rot":{"x":0, "y":0, "z":0}, "scale":{"x":1, "y":1, "z":1}}],
		 ["offroadtire_01a_17x9_33", ["wheel_FL","wheelhub_a_FL","wheelhub_b_FL"], [], {"pos":{"x": 0.8375, "y":-1.463, "z":0.46}, "rot":{"x":0, "y":0, "z":0}, "scale":{"x":1, "y":1, "z":1}}],
	],
  • pos - Position is where you position the wheels to match your HubWheels. Measurement is in meters.
  • rot - Rotation is how you'll flip the wheels for each side of the vehicle, by default all wheels are facing to the left, so to make them face right, you will set an offset of 180 on the Z axis.
  • scale - Scale allows you to adjust the size of each wheel, 1 is the default scale for each wheel, 2 would be two times the size. Adjusting all scale values on all axis is needed to keep the wheels proportions.

Example Car split into 3 models

Here is an example of Multi-DAE, this Example Car has been split up into 3 different model files. Download it below.

Sample Car

File:Example car multidae.zip


Mesh Breaking

Mesh Breaking is a feature allowing 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. The Gavril H-Series Cargo Box Upfit provides an example of this feature; when the cargo box is ripped open, the box wall mesh breaks dynamically.

Mesh breaking occurs by default when a beam connecting two nodes of the same group breaks. Any flexbody assigned to this node group will have the nearest polygons deleted. Mesh breaking can be toggled for specific groups of beams with the following dictionary:

	{"disableMeshBreaking":true},
    {"disableMeshBreaking":false},

In some cases mesh breaking is undesirable, such as when using strengthening beams that may break without bifurcation of the underlying structure. In most situations the recommended approach is to use separate meshes for parts that may come loose.

Vehicle Creation
Get started: Introduction to Vehicle Creation
JBeam
Overview
Physics
Dynamics
Visuals
Extras
Upkeep
Deprecated
See also: JBeam ExamplesJBeam Physics Theory