DeformGroups

DeformGroups

From BeamNG

DeformGroups are used to toggle the material of a mesh based on beam deformation (or breakage).

They are used for breaking glass and lights.

A mesh with a deformGroup assigned to it must be all one material, since the system works by changing the material of the entire mesh.

The system is compatible with the glowMaps lights system. A mesh can have multiple dummy materials and work with deformGroups as long as the eventual displayed material is the same.

DeformGroups exist in two places - in the flexbodies section applied to a mesh, and in the beams section to determine what beams to trigger deformation with.

	"flexbodies": [
		 ["mesh", "[group]:","nonFlexMaterials"],
		 //the body
		 ["body", ["body"]],
		 ["subframe", ["body","subframe"]],
		 {"deformGroup":"windshield_break", "deformMaterialBase":"glass", "deformMaterialDamaged":"glass_dmg"}
		 ["windshield", ["body"]],
		 {"deformGroup":""}
	],

Always remember to "close" any properties by setting them to blank, as shown.

	"beams": [
		 ["id1:", "id2:"],
		 //windshield
		 {"deformationTriggerRatio":0.03}
		 {"deformGroup":"windshield_break"}
		 ["wi1","wi2"],
		 {"deformGroup":""}
	],

DeformationTriggerRatio is the threshold of deformation at which the deformGroup triggers the material switch. If any beam that's part of this deformGroup breaks this will also trigger the switch.