Triggers2

This feature is supported as of BeamNG.tech and .drive version 0.31 to latest.

Triggers2 is an improvement of the Triggers section. Combined with the triggerEventLinks2 and actionsEnabled sections, it offers a more natural link between triggers and input actions. These sections make it possible to show and hide certain actions on the UI depending on the parts equipped on the vehicle.

Since update 0.40, “mesh triggers” are supported. They are triggers with an additional “mesh” property, which makes it so when hovering over the trigger, instead of its ‘hitbox’ visually showing, a mesh (flexbody or prop) on a vehicle is highlighter, which makes for a more visually pleasing experience.

Interaction maps

Triggers2 require an action map or an interaction map in order to work. The interaction map can be defined in a file with a *.interaction.json suffix. The format of the file is the same as of input_actions.json , and it can replace that file. The keyboard and controller input maps associated with it will still work after the name change. There can be many files with the *.interaction.json suffix for modding purposes. There is also a shared interaction map in the common vehicle folder which contains some generic interactions such as door latches. Example of an interaction map file:

{
    "fileversion": 2,
    "actions": {
        //the content here is the same as in input_actions.json
        "sleeper_door_R":      {"order":   50.1, "onDown":"controller.getControllerSafe('sleeperDoorRCoupler').toggleGroup()", "title": "vehicle.interaction.sleeperDoorR.toggle.title", "desc": "vehicle.interaction.sleeperDoorR.toggle.desc" },,
        "sleeper_door_L":      {"order":   50.2, "onDown":"controller.getControllerSafe('sleeperDoorLCoupler').toggleGroup()", "title": "vehicle.interaction.sleeperDoorL.toggle.title", "desc": "vehicle.interaction.sleeperDoorL.toggle.desc" },
    }
}

For the full *.interaction.json file format and workflow, see Interaction Maps .

Triggers2 section arguments

Note: The “label” argument has been removed.

Required arguments

string
type
Uniquely identifies the trigger. Need to be unique for the whole vehicle
number
type
Reference node for the coordinate system
number
type
X node for the coordinate system
number
type
Y node for the coordinate system
string
type
Type of the trigger

valid values:

  • box
  • sphere
dictionary or number
type
{“x”:1, “y”:1, “z”:1} (box), 1 (sphere)
default
Size in 3D coordinates in case of Box type, radius in case of Sphere type

example value for Box type:

{"x":0.25, "y":0.05, "z":0.08}

example value for Sphere type:

0.25
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Rotation in Euler angles (degrees)

Uses the intrinsic Euler -X -Z -Y rotation system, the center of rotation being the corner of the box that defines position.

example value:

{"x":0, "y":0, "z":0}
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Rotation in Euler angles (degrees)
Used for animation and alike. Unused right now.
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Translation in local coordinate system
Used for animation and alike. Unused right now.
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Initial translation in local coordinate system

Uses the intrinsic Euler -X -Z -Y rotation system, the center of rotation being the corner of the box that defines position.

example value:

{"x":0.2, "y":0.26, "z":-0.05}

Optional arguments

string or array
type
If used, the ‘clickable box’ becomes invisible, and the mesh (or meshes) provided get highlighted instead
The mesh can be a flexbody or a prop, it can be multiple of them in an array. It must be unique, used only once on the entrie vehicleW. It can be invisible, it will still be highlighted then. The ‘clickable box’ is still used as a ‘hitbox’ for the trigger.
number
type
Default debugDraw opacity
default
Opacity of the trigger when clicked
Accepts value in the range of 0 to 1. Does not affect triggers with “mesh” property.
table
type
Default debugDraw color
default
Color of the trigger when not clicked, and of the hint box
RGBA format. Hint box uses [0, 0, 1, 0.4] by default which is different than the default trigger color.
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Initial translation of the prop in JBeam/world space (meters)

Overwrites baseTranslation.

Relative to the Jbeam/world coordinates. {“x”:0, “y”:0, “z”:0} will put the prop in the position 0, 0, 0 according to the coordinates of the modelling software.

dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Same as baseTranslationGlobal but allows prop to maintain certain proportional distance from ref nodes as they stretch or compress
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Same as baseTranslationGlobal but prop becomes fixed a certain distance away from ref nodes
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Additional base offset on the global axis
Used internally by lua, possible to overwrite in Jbeam, but that is untested in practice.

TriggerEventLinks2 section arguments

Note: This section no longer refers to events. They are not supported by triggers2. The “triggerInput” argument is the same as the old “action” argument.

Required arguments

string
type
ID of the trigger from triggers2
string
type
Name of the input used to trigger the event

Commonly used values are:

  • action0 = left mouse button
  • action1 = shift + left mouse button
  • action2 = middle mouse button
string
type
name of the action of the actionmap/interaction map to trigger

When used without a prefix, the name will be found in a file with a *.interaction.json suffix in the vehicle’s own folder or the common folder. Default interactions are in vehicles\common\default.interaction.json and in each vehicle’s own folders in case of exclusive features.

When the “common:” prefix is added to the action name, it will be found in the VehicleCommonActionMap . You can see the available actions in lua\ge\extensions\core\input\actions\vehicle.json.

Optional arguments

boolean
type
false
default
If set to true, the VALUE passed to the linked event in *.interaction.json will be multiplied by -1

ActionsEnabled

Actions in *.interaction.json files, similarly to custom action maps, will be disabled by default (this means the tooltip showing the key mapped to them in top right corner of the screen will not be displayed, but the code will still be executed when that key is pressed). They can be enabled in Jbeam for a vehicle part that uses them using the ActionsEnabled section. It only takes one argument which is the ID of the action to enable. Example usage:

"actionsEnabled": [
    ["id"],
    ["door_FR"],
],

This is especially useful for vehicles that have lots of possible actions and only a small part of them is usable at a time depending on the chosen parts, like a semi truck with multiple upfit variants and interior controls.

Simple Example

A standard triggers2 setup for a door latch. It makes use of the door_FR action defined in common_default.interaction.json.

"triggers2":[
    ["id", "idRef:", "idX:", "idY:", "type", "size", "baseRotation", "rotation", "translation", "baseTranslation"],
    ["door_R", "d3r","d2r","d6r", "box", {"x":0.1, "y":0.03, "z":0.1}, {"x":0, "y":90, "z":0}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":0.24, "y":0.13, "z":-0.003}],
    ["door_R_int", "d4r","d5r","d1r", "box", {"x":0.1, "y":0.03, "z":0.1}, {"x":-0, "y":0, "z":-0}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":0.15, "y":-0.2, "z":0.0175}],
],
"triggerEventLinks2":[
    ["triggerId:triggers2", "triggerInput", "inputAction"],
    ["door_R", "action0", "door_FR"],
    ["door_R_int", "action0", "door_FR"],
],
"actionsEnabled": [
    ["id"],
    ["door_FR"],
],

Advanced Example

A more complicated setup, which uses colored triggers, actions from VehicleCommonActionMap, and a custom action from the vehicle’s interaction map.

"triggers2": [
    ["id", "idRef:", "idX:", "idY:", "type", "size", "baseRotation", "rotation", "translation", "baseTranslation"],
    ["sw_ignition", "dsh","dshr","dsh2", "box", {"x":0.05, "y":0.02, "z":0.02}, {"x":17, "y":-5, "z":8}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.19, "y":0.155, "z":0.129}, {"deformGroup":"", "color": [0, 0, 1, 0.4]}],
    ["sw_starter", "dsh","dshr","dsh2", "box", {"x":0.05, "y":0.05, "z":0.05}, {"x":17, "y":-5, "z":8}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.18, "y":0.24, "z":0.094}, {"deformGroup":"", "color": [0, 0, 1, 0.4]}],
    ["trailerAir",  "dsh","dshr","dsh2", "box", {"x":0.07, "y":0.03, "z":0.07}, {"x":8, "y":-8, "z":-24}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":0.025, "y":0.053, "z":-0.036}, {"deformGroup":"", "color": [0, 0, 1, 0.4]}],
    ["parkingBrake",  "dsh","dshr","dsh2", "box", {"x":-0.07, "y":0.03, "z":0.07}, {"x":8, "y":-8, "z":-24}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.001, "y":0.057, "z":-0.025}, {"deformGroup":"", "color": [0, 0, 1, 0.4]}],
],
"triggerEventLinks2": [
    ["triggerId:triggers2", "triggerInput", "inputAction"],
    ["sw_ignition", "action0", "common:activateStarterMotor"],
    ["sw_starter", "action0", "common:setIgnitionLevel3Momentary"],
    ["parkingBrake", "action0", "common:parkingbrake"],
    ["trailerAir", "action0", "toggleTrailerAirSupply"],
],
"actionsEnabled": [
    ["id"],
    ["toggleTrailerAirSupply"],
],

The corresponding action from the interaction map:

"toggleTrailerAirSupply":  {"order":   30.1, "energyStorage.getStorageSafe('mainAirTank'):toggleConsumerPressureCoef()""title": "vehicle.interaction.pneumatics.trailerAirSupply.toggle.title", "desc": "vehicle.interaction.pneumatics.trailerAirSupply.toggle.desc" },
Last modified: October 19, 2026

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.