Triggers

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

The Triggers section is used to position clickable boxes on vehicles which emulate buttons, switches, door handles and other hand-operated components.

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.

This section cannot exist on its own. It needs an Event section, which determines the code to be executed, and TriggerEventLinks which links the two.

  • events defines the actual things to execute (like input_actions.json, but inside a part)
  • triggerEventLinks links together triggers and events

For the newer triggers2 workflow, action code is usually defined in *.interaction.json files instead. See Interaction Maps and Triggers2 .

0.40.2.0 contains 3 entries in 1 sections distributed over 21543 parts in 5434 jbeam files.

Triggers section arguments

Required arguments

string
type
Uniquely identifies the trigger. Need to be unique for the whole vehicle
string
type
If not empty, will displays a descriptive text above the trigger
Deprecated.
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
Initial 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)
Deprecated.
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
Translation in local coordinate system
Deprecated.
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 vehicle. 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.
string
type
The deformGroup that will disable the trigger when activated
Deprecated.
number
type
0.15
default
Max distance from which trigger is visible (m)
Deprecated. Always 0.15m no matter the setting.

TriggerEventLinks section arguments

string
type
ID of the trigger
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
ID of the event

Events section arguments

Required arguments

string
type
Uniquely identifies the event. Need to be unique for the whole vehicle
string
type
Title of the action
Very short name of the action, will be displayed in various game menues
string
type
Description of the action
Full description, may be displayed as tool-tip, should be about one sentence long

Optional arguments

At least one of them must be defined for the event to work.

string
type
Code to be executed when the trigger input changes
string
type
Code to be executed when the trigger input is pressed down
string
type
Code to be executed when the trigger input is lifted up

Simple Example

{
  "triggers":[
    ["id", "label", "idRef:", "idX:", "idY:","type", "size", "baseRotation", "rotation","translation", "baseTranslation"],
    ["cargodoorR", "", "cd4r","cd4rr","cd3r", "box",{"x":0.25, "y":0.05, "z":0.08},{"x":0, "y":0, "z":0},{"x":0, "y":0, "z":0},{"x":0, "y":0, "z":0},{"x":0.2, "y":0.26, "z":-0.05}],
  ],
  "triggerEventLinks":[
    ["triggerId:triggers", "action", "targetEventId:events"],
    ["cargodoorR", "action0", "toggle_doorR"]
  ],
  "events":[
    ["id", "title", "desc"],
    ["toggle_doorR", "ui.inputActions.van.toggle_doorR.title", "ui.inputActions.van.toggle_doorR.description", {"onUp":"electrics.values.doorR = 1-(electrics.values.doorR or 0)", "order": 2}]
  ],
}
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.