Triggers

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

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

0.32.2.0 contains 788 entries in 455 sections distributed over 16745 parts in 4469 jbeam files.

Triggers section 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
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}

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 = right 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: 16/4/2024 14:55

Any further questions?

Join our discord