Beams

Beams

From BeamNG

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


Beams

Beams

NodeBeamInfo.png

Where BeamNG gets its name - beams. These are the spring connections between nodes. A beam starts as simply a list of two node IDs to define the connection. But, it has many properties that can be set. The main 4 are beamSpring, beamDamp, beamDeform, and beamStrength. beamSpring is basically the stiffness or rigidity of the beam. beamDamp determines how much energy gets dissipated when the beam contracts or expands. To represent different materials, it's important to know their relative characteristics. Metal is very stiff and not well damped, while plastic is softer and more damped. Rubber is even farther past plastic with very low stiffness and very high damping. Important: If too much spring or damping is added to a beam, physics instability may occur! beamDeform is the threshold force at which the beam's deformation will become permanent. The lower this is set, the lower the force needed to permanently deform the beam. beamStrength is the threshold at which the beam breaks. This should always be above the deform threshold, except for special cases like glass. If beamDeform and beamStrength are close in value, the beam will be brittle. If beamStrength is far higher than beamDeform, the beam will be tough, more resistant to impacts.


This is an example of a beams section:

	"beams": [
		  ["id1:", "id2:"],
		  {"breakGroupType":0},
		  //--frame-
		  {"breakGroup":"frame"},
		  {"beamSpring":1251000,"beamDamp":250},
		  {"beamDeform":16000,"beamStrength":24000},
		  ["f1rr","f1r"],
		  ["f1r","f1l"],
		  ["f1l","f1ll"],
		  {"breakGroup":""},
	],

Advanced Beam Properties

There are advanced beam properties that can be used to achieve some unique behaviors.


There are several advanced beam types:

Bounded beams use two sets of spring and damp values, and have a settable range of inbound and outbound travel. Within regular travel they use beamSpring and beamDamp. After they reach the inbound/outbound limits, they transition to using beamLimitSpring and beamLimitDamp. This can be useful for a vehicle's shocks or springs (simulating the bump stops), or for creating a progressive spring (the limit is not a hard one - the spring increases linearly).

Example syntax for a bounded beam:

{"beamLimitSpring":8001000,"beamLimitDamp":1200},
{"beamSpring":0,"beamDamp":0,"beamDeform":500000,"beamStrength":1000000},
{"beamPrecompression":1, "beamType":"|BOUNDED", "beamLongBound":0.25, "beamShortBound":0.25},
["n1","n2"],

Anisotropic beams have different spring and damping values for when they are either shorter or longer than their spawned length. They are primarily used to represent structures that are soft in compression, but very strong in expansion, such as a tire's sidewall.

Support beams are a good way to stop unwanted self-collision and clipping, and can also be used in place of the more computationally expensive bounded beams. Support beams resist compression only. They automatically break when overextended a certain amount (determined by beamLongBound).

Pressured beams simulate the effect of air pressure to create a progressive spring behavior. These are used primarily in hubWheels (deprecated tire model), but may have other uses.

Hydro beams expand or contract on demand from user input from steering, key bindings, or vehicle lua. They are primarily used for vehicle steering but can be used to provide linear motion or force much like a hydraulic ram.


In addition to the various beam types, there are also advanced damping options, useful for simulating sophisticated shock absorbers. Important: These damping options should be set inline per-beam, rather than applying to all subsequent beams, as there is no good way to reset them to "default." There's beamDampRebound, which is the damping of a beam when expanding.

Example syntax for a beam with beamDampRebound set inline:

["node1","node2",{"beamDampRebound":6300}],

There are also fast damping options. The velocity split is the division between using the normal and fast damping values. Again, these should be set inline.

Example syntax:

["axshr","fr17r",{"beamDampRebound":6000,"beamDampVelocitySplit":0.15,"beamDampFast":3200,"beamDampReboundFast":4200}],

Any beam can be precompressed. This just changes the beam's length by a relative factor immediately on spawn. 1.0 is default length, while 2.0 would be double length and 0.5 would be half length. Setting precompression on support beams can be useful if you want to allow a bit of contraction before the beam exerts a force. Precompression can be used on suspension beams to set ride height or wheel alignment.


Arguments

Arguments


Common Beam arguments

Name Type Optional Default Value Description
id1 string NOk n/a name of the first node
id2 string NOk n/a name of the second node
beamType bitmask Ok NORMAL Sets the type of the beam. Possible values:
  • NORMAL
  • HYDRO
  • ANISOTROPIC
  • BOUNDED
  • PRESSURED
  • SUPPORT
  • BROKEN
  • LBEAM
beamStrength float Ok options.beamStrength Strength of the beam. How much force the beam can resist before breaking (N).
beamSpring float Ok options.beamSpring Spring of the beam. How much a beam will change length when a force is applied (N/m).

Analogous to terms such as stiffness, rigidity, or modulus.

beamDamp float Ok options.beamDamp Damp of the beam. How much energy is dissipated as a beam changes length (N/m/s).

Damping causes vibration in the beam to fade out over time.

beamDeform float Ok options.beamDeform Deform of the beam. How much force the beam can resist before it deforms permanently (N). Note: All beams have a hardcoded minimum beam deformed length of 2cm. Beams cannot be permanently deformed beyond this length even if they spawn that small.
beamPrecompression float Ok 1.0 Pre-compression of the beam. How much longer or shorter the beam will try to become as soon as it spawns.

2.0 would be twice the length, 0.5 would be half the length.

breakGroup float Ok "" The breakGroup of this beam
breakGroupType float Ok 1.0 This sets the breakGroup behaviour. if set to 0, this beam will break others in the breakGroup. if set to 1, this beam will NOT break others in the breakGroup, but will be broken by the group.

Anisotropic Beam arguments

Name Type Optional Default Value Description
springExpansion float Ok options.beamSpring Spring of the beam when the beam has expanded beyond spawned length.
dampExpansion float Ok options.beamDamp Damp of the beam when the beam has expanded beyond spawned length.
beamLongBound float Ok infinity


Bounded Beam arguments

Name Type Optional Default Value Description
beamLongBound float Ok 1.0 How far the beam can expand before limit properties are applied.

0.0 would mean that the beam can't expand without applying the beamLimitSpring/beamLimitDamp

0.5 would mean that the beam can expand to 150% of its spawned length,

1.0 would mean that the beam can expand to 200% of its spawned length before beamLimitSpring/beamLimitDamp begins to apply.

beamShortBound float Ok 1.0 How short the beam can go before limit properties are applied.

0.0 would mean that the beam can't contract without applying the beamLimitSpring/beamLimitDamp,

0.5 would mean that the beam can contract to 50% of its spawned length,

1.0 would mean that the beam can contract its entire length before beamLimitSpring/beamLimitDamp begins to apply.

beamLimitSpring float Ok 1.0 The spring applied when the beam length reaches longBound or shortBound.
beamLimitDamp float Ok 1.0 The damping applied when the beam length reaches longBound or shortBound.
beamDampRebound float Ok beamDamp The damping value specifically for expansion of the beam.

beamDamp will continue to affect contraction when this argument is used.

beamDampFast float Ok beamDamp The damping value for the beam when the beam's rate of contraction/expansion is higher than beamDampVelocitySplit.
beamDampReboundFast float Ok beamDampRebound The rebound damping value for the beam when the beam's rate of expansion is higher than beamDampVelocitySplit.

beamDampFast will continue to affect contraction when this argument is used.

beamDampVelocitySplit float Ok infinity The rate (m/s) of contraction/expansion over which beamDampFast and beamDampReboundFast take effect.

Support Beam arguments

Name Type Optional Default Value Description
beamLongBound float Ok 1.0 When this bound is exceeded, the beam automatically breaks.

0.5 would mean the beam breaks after expanding to 150% of its spawned length.

Pressured Beam arguments

Name Type Optional Default Value Description
pressure float Ok
surface float Ok 1.0
volumeCoef float Ok 1.0
maxPressure float Ok

L-Beam arguments

Name Type Optional Default Value Description
id3 float NOk n/a Name of the third node. The third node must already be connected to nodes [id1] and [id2] with beams.

Any change in angle between beams [id1,id3] and [id2,id3] is then resisted by the L-Beam from [id1,id2]. Example L-Beam definition: ["node_id1","node_id2",{"id3:":"node_id3"}],

L-Beams are primarily used in pressureWheels since 0.5.2.0, and in later version also with leafsprings. They are a type of beam that acts like an angular spring between two other beams.

Default beam values

BeamNG uses default values so if one doesn't define a value, these are being used. The values are taken from the jbeam_main lua file.


beamSpring: vehicle.options.beamSpring = 4300000 (N/m)


beamDeform: vehicle.options.beamDeform = 220000 (N)


beamDamp: vehicle.options.beamDamp = 580 (N/m/s)


beamStrength: vehicle.options.beamStrength = math.huge ("FLT_MAX") (N)


nodeWeight: vehicle.options.nodeWeight = 25 (kg)



Break Groups

Break Groups

Break groups are pretty simple and useful. Defining a set of beams in a break group means that if one beam breaks, the rest of the beams break as well. Additionally, "breakGroupType" may be set to change behavior. Beams with breakGroupType 1 will break when their breakgroup is triggered, but will not trigger the break group if they break alone. This can be useful for something like a steering hydro, where it should be able to break on its own, but also break when the entire wheel detaches.

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