Beams
Beams
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
Common Beam arguments
Name | Type | Optional | Default Value | Description |
---|---|---|---|---|
id1 | n/a | name of the first node | ||
id2 | n/a | name of the second node | ||
beamType | NORMAL | Sets the type of the beam. Possible values:
| ||
beamStrength | options.beamStrength | Strength of the beam. How much force the beam can resist before breaking (N). | ||
beamSpring | 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 | 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 | 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 | 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 | "" | The breakGroup of this beam | ||
breakGroupType | 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 | options.beamSpring | Spring of the beam when the beam has expanded beyond spawned length. | ||
dampExpansion | options.beamDamp | Damp of the beam when the beam has expanded beyond spawned length. | ||
beamLongBound | infinity |
Bounded Beam arguments
Support Beam arguments
Pressured Beam arguments
Name | Type | Optional | Default Value | Description |
---|---|---|---|---|
pressure | ||||
surface | 1.0 | |||
volumeCoef | 1.0 | |||
maxPressure |
L-Beam arguments
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 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 | ||||||||||||||||
| ||||||||||||||||
See also: JBeam Examples • JBeam Physics Theory |