Skip to main content

Triggers

There are 35 triggers, and each one can start an event. Scripts hear many of them through ctx.on(...), and patches through their event nodes. Key reaches them as on-keydown and on-keyup, and Press on the object as on-mousedown, on-mouseup and on-click. See The ctx API.

Some triggers have branches, one for each outcome. Each branch has its own list of steps, so one event can handle every outcome. See Events.

In the editorCategoryBranchesId (for scripts and patches)
Game controlscontrolidle, move, jump, runon-game-control
UI actionexternal—on-divkit-action
Signalexternal—on-signal
Variable changeexternal—on-variable-change
Hover outinput—on-blur
Clickinput—on-click
Double clickinput—on-double-click
Draginput—on-drag
Hoverinputenter, exiton-hover
Keyinputdown, upon-key
Long pressinput—on-long-press
Press on the objectinputclick, down, upon-mouse
Pinchinput—on-pinch
Pointer lockinput—on-pointer-lock
Cursor moveinput—on-pointer-move
Rotateinput—on-rotate
Scrollinput—on-scroll
Launchlifecycle—on-launch
Pauselifecycle—on-pause
Resizelifecycle—on-resize
Resumelifecycle—on-resume
Visibilitylifecycleshow, hideon-visibility
Collisionphysics—on-collide
Distanceproximityenter, exiton-distance
State activestate—on-state-active
State inactivestate—on-state-inactive
Every N secondstime—on-interval
Delaytime—on-timeout
Detecttracking—on-detect
Tracking losttracking—on-lost
Placedtracking—on-placed
VPS errortracking—on-vps-error
VPS localizedtracking—on-vps-localized
VPS localization failedtracking—on-vps-not-localized
VPS readytracking—on-vps-ready

Settings​

Game controls​

Id: on-game-control

Category control · branches idle, move, jump, run

SettingTypeDefaultOptions or label
modeselect"walk"walk, fly, top_down
turnToMovebooleantrueAuto-orient
towardsselect"camera"camera, axis
cameraRelativebooleantrueCamera relative
speednumber3Pos. Speed
runMultipliernumber2Run Factor
turnSpeednumber720Rot. Speed
posDelayInnumber0Pos. Delay
posDelayOutnumber0
rotDelayInnumber0Rot. Delay
rotDelayOutnumber0
schemeselect"both"wasd, arrows, both
rotateByselect"mouse"mouse, keys, both
touchbooleantrueTouch controls
touchRotateByselect"drag"drag, joystick
stickCornerselect"bottom_left"top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center, bottom_right
jumpCornerselect"bottom_right"top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center, bottom_right
touchOffsetXnumber30Offset
touchOffsetYnumber30
buttonSizenumber120Button Size
touchVisibilityselect"show"show, hide
colliderShapeselect"capsule"capsule, sphere
colliderRadiusnumber0.5Size
colliderHeightnumber1.8
colliderXnumber0Position
colliderYnumber0.9
colliderZnumber0
massnumber1Mass
colliderHelperselect"hide"show, hide
jumpHeightnumber0Jump
airControlnumber0.3Air Control
resetYnumber0Rst Y-offset
clickToMovebooleanfalseClick To Move
followCameraentitynullCamera
orientToselect"normal"normal, angle
camPosDelaynumber0.12Pos. Delay
camRotDelaynumber0.08Rot. Delay
upDownselect"yes"yes, no, limit
upDownMinnumber0Limit
upDownMaxnumber89
leftRightselect"yes"yes, no, limit
leftRightMinnumber-90Limit
leftRightMaxnumber90

UI action​

Id: on-divkit-action

Category external

SettingTypeDefaultOptions or label
idstring—Action id

Signal​

Id: on-signal

Category external

SettingTypeDefaultOptions or label
signalstring""Signal

Variable change​

Id: on-variable-change

Category external

SettingTypeDefaultOptions or label
variablestring""Variable

Hover out​

Id: on-blur

Category input

No settings.

Click​

Id: on-click

Category input

SettingTypeDefaultOptions or label
buttonselect"any"any, left, right, middle

Double click​

Id: on-double-click

Category input · scope entity

SettingTypeDefaultOptions or label
buttonselect"any"any, left, right, middle

Drag​

Id: on-drag

Category input · scope entity · only on anchors surface

No settings.

Hover​

Id: on-hover

Category input · branches enter, exit · scope entity

No settings.

Key​

Id: on-key

Category input · branches down, up

SettingTypeDefaultOptions or label
codestring—Code
codesarray[]Keys
ctrlbooleanfalse
altbooleanfalse
shiftbooleanfalse
metabooleanfalse
doublebooleanfalseDouble press
bindstring""Project bind
altsarray[]Alternatives
ignoreRepeatbooleanfalseIgnore auto-repeat

Long press​

Id: on-long-press

Category input · scope entity

SettingTypeDefaultOptions or label
buttonselect"any"any, left, right, middle

Press on the object​

Id: on-mouse

Category input · branches click, down, up · scope entity

SettingTypeDefaultOptions or label
buttonselect"any"any, left, right, middle
ctrlbooleanfalse
altbooleanfalse
shiftbooleanfalse
metabooleanfalse
doublebooleanfalseDouble press
bindstring""Project bind
altsarray[]Alternatives

Pinch​

Id: on-pinch

Category input · scope entity · only on anchors surface

No settings.

Pointer lock​

Id: on-pointer-lock

Category input

No settings.

Cursor move​

Id: on-pointer-move

Category input

No settings.

Rotate​

Id: on-rotate

Category input · scope entity · only on anchors surface

No settings.

Scroll​

Id: on-scroll

Category input

SettingTypeDefaultOptions or label
directionselect"any"any, up, down

Launch​

Id: on-launch

Category lifecycle

No settings.

Pause​

Id: on-pause

Category lifecycle

No settings.

Resize​

Id: on-resize

Category lifecycle

No settings.

Resume​

Id: on-resume

Category lifecycle

No settings.

Visibility​

Id: on-visibility

Category lifecycle · branches show, hide

No settings.

Collision​

Id: on-collide

Category physics

No settings.

Distance​

Id: on-distance

Category proximity · branches enter, exit

SettingTypeDefaultOptions or label
targetentitynullOther object
distancenumber1Distance
fireOnStartbooleanfalseCheck at start

State active​

Id: on-state-active

Category state · fires for each state

No settings.

State inactive​

Id: on-state-inactive

Category state · fires for each state

No settings.

Every N seconds​

Id: on-interval

Category time

SettingTypeDefaultOptions or label
secondsnumber1Every
repeatnumber0Repeat

Delay​

Id: on-timeout

Category time

SettingTypeDefaultOptions or label
secondsnumber1After

Detect​

Id: on-detect

Category tracking · only on anchors image, qr, face, body, surface

No settings.

Tracking lost​

Id: on-lost

Category tracking · only on anchors image, qr, face, body, surface

No settings.

Placed​

Id: on-placed

Category tracking · only on anchors surface

No settings.

VPS error​

Id: on-vps-error

Category tracking · only on anchors surface

No settings.

VPS localized​

Id: on-vps-localized

Category tracking · only on anchors surface

No settings.

VPS localization failed​

Id: on-vps-not-localized

Category tracking · only on anchors surface

No settings.

VPS ready​

Id: on-vps-ready

Category tracking · only on anchors surface

No settings.