Triangles

Triangles, also known as coltris, are surfaces that fill-in the space between nodes. They are essential to allow for collisions between vehicles, and are also used to define the aerodynamic properties of objects.

Triangles are defined by 3 nodes, chosen in a counter clockwise order.

Collisions

The primary function of triangles is to allow for collisions between jbeamed objects (cars and props). It should be noted that coltris will only collide with nodes. This will not collide with other coltris or with static world objects.

Triangles have sides, shown as green and purple in the triangle view debug, for the front and back respectively. While both sides have collisions and aero properties, it is preferable to have the front end of the triangle be exposed, as it is less prone to objects phasing through in case of very hard impacts. You can flip a triangle by swapping any 2 of it’s nodes.

Aero

The aero system in beamNG works by calculating drag on all triangles based purely on the speed of the airflow, the surface area and drag properties of the triangles. The drag and lift forces are then applied on the adjacent nodes. Triangles are not affected by other triangles, meaning that triangle in the back of your vehicle will still create the full drag.

Because of this, you might need to fine tune the drag coefficient of your various components based on how exposed to airflow they are. This also lets you add surfaces to simulate ground effect, or fine tune the lift distribution on your vehicle.

The system simulates lift based on the angle of attack of the triangle compared to the airflow, meaning a triangle tilted upward will create lift, while a triangle tilted downward will create downforce. A larger angle will create more lift, as long as you don’t go past the stalling angle, at which point the lift will start going down with added angle.

Pressure simulation

An enclosed volume can also be used to do pressure simulation. This is used to make objects float, as well as for tires and baloon like objects like the matress.

When using the pressure simulation system, make sure that the enclosed volume has a regular shape with no missing surfaces or concave surfaces, to avoid ghost forces.

Required arguments

"triangles": [
        ["id1:","id2:","id3:"],
        ["a", "b", "c"],
],
string
type
The id of the first node that defines the triangle
string
type
The id of the second node that defines the triangle
string
type
The id of the third node that defines the triangle

Optional arguments

number
type
100
default
Drag coefficient of the triangle as a percentage of a flat plate of the same size.
Typical values are around 10 for most exposed body panels.
float
type
0
default
Skin drag coefficient of the triangle as a percentage of a flat plate of the same size.
Additional drag coefficient defined along the triangle surface rather than across. Used to simulate paddle-like treads in mud tires. Usually not used otherwise.
number
type
dragCoef
default
Lift coefficient of the triangle as a percentage of a flat plate of the same size.
Values between 80 and 120 are commonly used for spoilers.
number
type
0.58
default
Angle of attack in radian at which the triangle will start to stall and produce less lift.
string
type
NORMALTYPE
default

The available triangle types are :

“NORMALTYPE” : Used for most applications

“NONCOLLIDABLE” : Have no collisions or aero. Used to keep the anticlip system working with nodes that have collisions but no triangles like suspension and exhaust.

string
type
Defines a group of triangles as being a pressure volume. Used for flotation and pressure simulation.
number
type
Sets the pressureGroup pressure in PSI
number
type
Sets the pressureGroup pressure in Pascal
string
type
Used to allow triangles to break when triggered by beams in the same break group.
boolean
type
false
default
Deactivates errors when one of the triangle’s nodes is missing.
This is used for cases where one of the nodes that make up the triangle is located in an optional component.
string
type
asphalt
default
Ground model of the triangle. Determines friction behavior.

As of version 0.33.3.0 the following physics materials are available:
METAL, PLASTIC, RUBBER, GLASS, WOOD, FOLIAGE, CLOTH, WATER, ASPHALT, ASPHALT_WET, SLIPPERY, ROCK, DIRT_DUSTY, DIRT, SAND, SANDY_ROAD, MUD, GRAVEL, GRASS, ICE, SNOW, FIRESMALL, FIREMEDIUM, FIRELARGE, SMOKESMALLBLACK, SMOKEMEDIUMBLACK, STEAM, RUMBLE_STRIP, COBBLESTONE, FOLIAGE_THIN, SPIKE_STRIP

The parameters are explained here.

string
type
Biases one side of the collision detection system.

The allowed values are “in” and “out”, leaving the argument empty will result in no bias. On the biased side, collision triangles will be physically ’thicker’ than on the other, with the collision being detected earlier. Thicker collision means less chance of clipping through on high speed impacts, thinner means the structures can be positioned closer to each other on spawn.

This is useful for very small objects that will typically only collide with things from one side.

Simple Example

There’s a triangle between nodes a, b and c

"triangles": [
        ["id1:","id2:","id3:"],
        ["a", "b", "c"],
],

There’s a triangle between nodes a, b and c with a drag coefficient of 45.

"triangles": [
        ["id1:","id2:","id3:"],
        ["a", "b", "c", {"dragCoef":45}],
],

Advanced Example

Typical spoiler set-up with defined lift coefficient and stall angle.

    "triangles": [
        ["id1:","id2:","id3:"],
        {"dragCoef":35},
        {"groundModel":"plastic"},
        ["wing3ll","wing2ll","wing1l", {"liftCoef":90, "stallAngle":0.55}],
        ["wing2ll","wing2l","wing1l", {"liftCoef":90, "stallAngle":0.55}],

        ["wing1l","wing2l","wing2", {"liftCoef":90, "stallAngle":0.55}],
        ["wing1l","wing2","wing1", {"liftCoef":90, "stallAngle":0.55}],
    ],
Last modified: September 18, 2024

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.