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.

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" },
    }
}

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
type
The deformGroup that will disable the trigger when activated
array
type
Fraction based RGBA values that define the trigger’s color

example value:

"color": [0, 0, 1, 0.4]

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.

List of available vanilla interactions
  • Openables
Action
Event
Action
door_L
Event
controller.getControllerSafe(‘door_L_coupler’).toggleGroup()
Action
door_R
Event
controller.getControllerSafe(‘door_R_coupler’).toggleGroup()
Action
door_FL
Event
controller.getControllerSafe(‘door_FL_coupler’).toggleGroup()
Action
door_FR
Event
controller.getControllerSafe(‘door_FR_coupler’).toggleGroup()
Action
door_RL
Event
controller.getControllerSafe(‘door_RL_coupler’).toggleGroup()
Action
door_RR
Event
controller.getControllerSafe(‘door_RR_coupler’).toggleGroup()
Action
door_RL_half
Event
controller.getControllerSafe(‘door_RL_coupler’).toggleGroupConditional({{ ‘door_FL_coupler’,‘attached’,‘vehicle.advancedCouplerControl.openFrontDoorFirst’}})
Action
door_RR_half
Event
controller.getControllerSafe(‘door_RR_coupler’).toggleGroupConditional({{ ‘door_FR_coupler’,‘attached’,‘vehicle.advancedCouplerControl.openFrontDoorFirst’}})
Action
door_rear
Event
controller.getControllerSafe(‘rearDoorCoupler’).toggleGroup()
Action
barndoor_L
Event
controller.getControllerSafe(‘barndoor_L_coupler’).toggleGroupConditional({{ ‘barndoor_R_coupler’,‘attached’,‘vehicle.advancedCouplerControl.openOtherSideFirst’}})
Action
barndoor_L_alt
Event
controller.getControllerSafe(‘barndoor_L_coupler’).toggleGroup()
Action
barndoor_RR
Event
controller.getControllerSafe(‘barndoor_RR_coupler’).toggleGroup()
Action
barndoor_RL
Event
controller.getControllerSafe(‘barndoor_RL_coupler’).toggleGroupConditional({{ ‘barndoor_RR_coupler’,‘attached’,‘vehicle.advancedCouplerControl.openOtherSideFirst’}})
Action
barndoor_R
Event
controller.getControllerSafe(‘barndoor_R_coupler’).toggleGroup()
Action
sidedoor
Event
controller.getControllerSafe(‘sidedoor_coupler’).toggleGroup()
Action
sidedoor_F
Event
controller.getControllerSafe(‘sidedoor_F_coupler’).toggleGroup()
Action
sidedoor_R
Event
controller.getControllerSafe(‘sidedoor_R_coupler’).toggleGroupConditional({{ ‘sidedoor_F_coupler’,‘attached’,‘vehicle.advancedCouplerControl.openOtherSideFirst’}})
Action
hoodCatch
Event
controller.getControllerSafe(‘hoodCatchCoupler’).toggleGroupConditional({{ ‘hoodLatchCoupler’,‘attached’,‘vehicle.advancedCouplerControl.releaseHoodFirstInterior’}})
Action
hoodRelease
Event
controller.getControllerSafe(‘hoodLatchCoupler’).toggleGroup()
Action
toggle_cargodoorRL
Event
controller.getControllerSafe(‘cargoDoorRLCoupler’).toggleGroup()
Action
toggle_cargodoorRR
Event
controller.getControllerSafe(‘cargoDoorRRCoupler’).toggleGroup()
Action
tailgate
Event
controller.getControllerSafe(’tailgateCoupler’).toggleGroup()
Action
tailgate_lower
Event
controller.getControllerSafe(’tailgateCoupler’).toggleGroupConditional({{ ’tailgateCouplerUpper’,‘attached’,‘vehicle.advancedCouplerControl.openUpperPartFirst’},{‘spareholderCoupler’,‘attached’,‘vehicle.advancedCouplerControl.openSpareHolderFirst’}})
Action
tailgate_upper
Event
controller.getControllerSafe(’tailgateCouplerUpper’).toggleGroup()
Action
tailgate_lower_alt
Event
controller.getControllerSafe(’tailgateCoupler’).toggleGroupConditional({{ ‘spareholderCoupler’,‘attached’,‘vehicle.advancedCouplerControl.openSpareHolderFirst’}})
Action
tailgate_upper_alt
Event
controller.getControllerSafe(’tailgateCouplerUpper’).toggleGroupConditional({{ ’tailgateCoupler’,‘attached’,‘vehicle.advancedCouplerControl.openLowerPartFirst’}})
Action
tailgateCatch
Event
controller.getControllerSafe(’tailgateCatchCoupler’).toggleGroupConditional({{ ’tailgateLatchCoupler’,‘attached’,‘vehicle.advancedCouplerControl.releaseTailgateFirstInterior’}})
Action
tailgateRelease
Event
controller.getControllerSafe(’tailgateLatchCoupler’).toggleGroup()
Action
trunk
Event
controller.getControllerSafe(’trunkCoupler’).toggleGroup()
Action
hatch
Event
controller.getControllerSafe(‘hatchCoupler’).toggleGroup()
Action
decklid
Event
controller.getControllerSafe(‘decklidCoupler’).toggleGroup()
Action
spareholder
Event
controller.getControllerSafe(‘spareholderCoupler’).toggleGroup()
Action
folding_step
Event
controller.getControllerSafe(‘step_coupler’).toggleGroup()
Action
roofbox
Event
controller.getControllerSafe(‘roofboxCoupler’).toggleGroup()
Action
lid_B
Event
controller.getControllerSafe(’lidBCoupler’).toggleGroup()
Action
lid_F
Event
controller.getControllerSafe(’lidFCoupler’).toggleGroup()
Action
lid_R
Event
controller.getControllerSafe(’lidRCoupler’).toggleGroup()
Action
lid_B2
Event
controller.getControllerSafe(’lidB2Coupler’).toggleGroup()
Action
lid_F2
Event
controller.getControllerSafe(’lidF2Coupler’).toggleGroup()
Action
lid_R2
Event
controller.getControllerSafe(’lidR2Coupler’).toggleGroup()
Action
porta_potty_door
Event
controller.getControllerSafe(‘portaPottyDoorCoupler’).toggleGroupConditional({{ ‘portaPottyLockCoupler’,‘attached’,‘vehicle.advancedCouplerControl.portaPotty’}})
Action
porta_potty_lock
Event
controller.getControllerSafe(‘portaPottyLockCoupler’).toggleGroup()
  • Police parts
Action
Event
Action
toggle_beacon
Event
    electrics.set_lightbar_signal(electrics.values.lightbar == 0 and 1 or 0)
Action
toggle_lightbar
Event
  electrics.set_lightbar_signal(electrics.values.lightbar == 0 and 1 or 0)
Action
toggle_siren
Event
     electrics.set_lightbar_signal(electrics.values.lightbar == 2 and 1 or 2)
Action
toggle_lightbar_siren
Event
electrics.set_lightbar_signal(electrics.values.lightbar == 0 and 2 or 0)
Action
lightbar_setmode_1
Event
for _, v in pairs(controller.getControllersByType(’lightbar’)) do v.setModeIndex(1) end
Action
lightbar_setmode_2
Event
for _, v in pairs(controller.getControllersByType(’lightbar’)) do v.setModeIndex(2) end
Action
lightbar_setmode_3
Event
for _, v in pairs(controller.getControllersByType(’lightbar’)) do v.setModeIndex(3) end
Action
lightbar_setmode_4
Event
for _, v in pairs(controller.getControllersByType(’lightbar’)) do v.setModeIndex(4) end
Action
toggle_lightbar_mode
Event
for _ ,v in pairs(controller.getControllersByType(’lightbar’)) do v.toggleMode() end
  • Semi truck and trailer
Action
Event
Action
fifthwheelDecouple
Event
controller.getControllerSafe(‘fifthwheel’).detachFifthwheel()
Action
pintleHitchToggle
Event
beamstate.toggleCouplers(‘pintle’, true, false, false)
Action
feet_up
Event
controller.getControllerSafe(’trailerFeet’).moveFeet(-VALUE)
Action
feet_down
Event
controller.getControllerSafe(’trailerFeet’).moveFeet(VALUE)
Action
toggle_jack
Event
electrics.values.feet = 1 - (electrics.values.feet or 0)
  • Lowrider hydraulics
Action
onDown
onUp
Action
hydraulics_jump_full
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsPosition({‘full’},1,15)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘full’},0.9)
Action
hydraulics_jump_front
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsPosition({‘frontAxle’},1,15)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontAxle’},1)
Action
hydraulics_jump_rear
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsPosition({‘rearAxle’},1,15)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearAxle’},1)
Action
hydraulics_jump_left
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsPosition({’leftSide’},1,15)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({’leftSide’},1)
Action
hydraulics_jump_right
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsPosition({‘rightSide’},1,15)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rightSide’},1)
Action
hydraulics_lower_full
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘full’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘full’},0)
Action
hydraulics_raise_full
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘full’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘full’},false,1)
Action
hydraulics_lower_front
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontAxle’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontAxle’},0)
Action
hydraulics_lower_rear
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearAxle’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearAxle’},0)
Action
hydraulics_lower_FL
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontLeft’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontLeft’},0)
Action
hydraulics_lower_FR
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontRight’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘frontRight’},0)
Action
hydraulics_lower_RL
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearLeft’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearLeft’},0)
Action
hydraulics_lower_RR
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearRight’},0.1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsBleed({‘rearRight’},0)
Action
hydraulics_raise_front
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontAxle’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontAxle’},false,1)
Action
hydraulics_raise_rear
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearAxle’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearAxle’},false,1)
Action
hydraulics_raise_FL
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontLeft’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontLeft’},false,1)
Action
hydraulics_raise_FR
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontRight’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘frontRight’},false,1)
Action
hydraulics_raise_RL
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearLeft’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearLeft’},false,1)
Action
hydraulics_raise_RR
onDown
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearRight’},true,1)
onUp
controller.getControllerSafe(‘hydraulicSuspension’).setGroupsMomentaryIncrease({‘rearRight’},false,1)
  • Shipping container couplers
Action
Event
Action
container_attach_h_bot
Event
beamstate.toggleCouplers(‘cp1_h’, true)
Action
container_attach_h_top
Event
beamstate.toggleCouplers(‘cp2_h’, true)
Action
container_attach_v_top
Event
beamstate.toggleCouplers(‘cp_v’, true)
  • JATO
Action
Event
Action
jato
Event
electrics.values.jatoInput = 1 - (electrics.values.jatoInput or 0)

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: December 10, 2025

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.