userTrigger
The userTrigger responds to a user entering or leaving a space. userTriggers can be spherical or box-shaped, and are usually invisible. You can use the userTrigger to make a light turn on when you walk into a room, make a sound play when you walk out of it, or tell an object to start animating when you walk near it.
A user, a userTrigger, and a light.

When the user enters the radius around the trigger,
it sends a message to the light.
// userTrigger.scene
// turns on a light when you walk near the trigger
#include "User0"
// put in a floor
object (file(floor.b3d))
// initial light color is a dim yellow
light light1 (diffuse (.2 .2 0))
// create a userTrigger node
userTrigger (volume (sphere 0 20 0 10),
when(enter,light1.diffuse(1 1 0)))
Node Reference
Derived from: ygSpaceMessages
| Message | Parameters | Default | Description |
| volume | string volumeShape, float coordinates ... sphere x y z radius box x1 y1 z1 x2 y2 z2 cylinder x1 y1 z1 x2 y2 z2 radius point x y z infinite |
infinite | defines the shape of the trigger's active area. the volumeShape can be one of the following:
|
Events
| Event | Variables | Description |
| enter | $user | a user has entered the space |
| exit | $user | a user has left the space |
| firstenter | $user | a user has entered the space |
| empty | all users have left the space |
(c) Ben Chang