Skip to content

Behaviours ​

Generated from @vrmxg/registry (m0Registry) by scripts/docs-reference.mjs. Don't edit it: change the code and run npm run docs:reference.

A behaviour is a named script attached to a node: an entry in the node's behaviours list, { "use": "<name>", …params }. The scene holds the name and the params; the project maps the name to code. A scene never carries code, and an unknown name keeps its data and runs nothing.

A behaviour can add signals and actions to the node it is on. These are the behaviours the registry declares; a project can add its own (the sample project's behaviours.js).

BehaviourAttaches toWhat
wanderCharacterWalk to random reachable points within a radius.
greetCharacterSays a line to someone who comes close (looking at them), then waits a while before greeting again.
switchedByNode3DShown while an item is in a state (a lamp lit while its switch is on), hidden otherwise.
hingeRigidBodyA door hinge: a revolute joint with limits and a motor.
noticeViewerCharacterSees the person at the camera (@vrmxg/sense): looks at them when they appear and away when they leave, answers a wave and a nod with animation slots, and can say lines. Needs the sense service and the scene's viewer node.
brainCharacterAn NPC brain: perception, memory, a behaviour tree with utility choices, and the action vocabulary. A role preset (server, customer, wanderer; host, conversationPartner, follower, which a director can talk with), a brain document in the project (brains/hana.json) or a preset object; vars override its blackboard plan.
playerCharacterDrives a Character from the move / jump / run actions, relative to the current camera (split screen: its player's actions and camera).
pickupInstance, Model, RigidBodyCan be picked up; equips a VRMXW if the item names one.

wander ​

Walk to random reachable points within a radius.

  • Attaches to: Character (and types that extend them)

Params

ParamTypeDefaultRange, unit
radiusnumber4≥ 0 m
pausenumber2≥ 0 s

greet ​

Says a line to someone who comes close (looking at them), then waits a while before greeting again.

  • Attaches to: Character (and types that extend them)

Params

ParamTypeDefaultRange, unitWhat
targetnode idWho to greet (the player).
radiusnumber2≥ 0 m
clipstringA voice line (.wav) with its timings beside it.
textstringThe caption (or the line, without a clip).
cooldownnumber20≥ 0 s

switchedBy ​

Shown while an item is in a state (a lamp lit while its switch is on), hidden otherwise.

  • Attaches to: Node3D (and types that extend them)

Params

ParamTypeDefaultWhat
itemnode idThe item (a switch).
statestring"on"

hinge ​

A door hinge: a revolute joint with limits and a motor.

  • Attaches to: RigidBody (and types that extend them)

Params

ParamTypeDefaultRange, unit
axisvec3 [x, y, z][0,1,0]
openAnglenumber100-180 to 180 °
lockedbooleanfalse

Signals it adds

Signal
opened
closed

Actions it adds

Action
open
close
toggle

noticeViewer ​

Sees the person at the camera (@vrmxg/sense): looks at them when they appear and away when they leave, answers a wave and a nod with animation slots, and can say lines. Needs the sense service and the scene's viewer node.

  • Attaches to: Character (and types that extend them)

Params

ParamTypeDefaultWhat
answersobject{"wave":"greet","nod":"nod"}Camera event (wave, nod, shake, point) → the animation slot that answers it.
sayobjectCamera event (appeared, wave, nod, shake, point) → a line to say.
smilestring"happy"The expression shown when someone appears.

brain ​

An NPC brain: perception, memory, a behaviour tree with utility choices, and the action vocabulary. A role preset (server, customer, wanderer; host, conversationPartner, follower, which a director can talk with), a brain document in the project (brains/hana.json) or a preset object; vars override its blackboard plan.

  • Attaches to: Character (and types that extend them)

Params

ParamTypeDefaultRange, unitWhat
presetany"wanderer"A role preset, a brain document's path, or a preset object ({ plan, senses, tree }).
varsobjectBlackboard values over the preset's plan.
tickEverynumber1≥ 1Think every n steps (four times slower far from the player).
lodDistancenumber25≥ 0 m
sensesobjectPerception settings over the preset's: sight { range, fov, every }, hearing { sensitivity }, proximity { radius }, maxAge, decay.

player ​

Drives a Character from the move / jump / run actions, relative to the current camera (split screen: its player's actions and camera).

  • Attaches to: Character (and types that extend them)

Params

ParamTypeDefaultRange, unitWhat
walkSpeednumber1.4≥ 0 m/s
runSpeednumber4≥ 0 m/s
playernumber11 to 4Which player: 2 reads the p2.* actions and player 2's camera.

pickup ​

Can be picked up; equips a VRMXW if the item names one.

Params

ParamType
itemstring

Signals it adds

SignalArguments
pickedUpby (node id)

The reference pages are generated from the engine's code.