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"],
],
Optional arguments
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.
As of version 0.34.2.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 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}],
],