VRML Script Tutorial
VRML Interactive Tutorial
Let there be Light
Materials with Colored Lights
VRML File Structure
Drawing: Shape node
Hierarchical Node Structures
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Let the Music Play
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes
The main difference between VRML 1.0 and VRML 2.0 is that every node can
send and receive events. Yes, in VRML 2.0 you can have animated objects
that react to users actions. Events output values depending on their data
In VRML 2.0 when some fields of a Node are changed after the world has
been loaded an event is generated. You may have noticed that some fields
in the syntax boxes, present in the tutorial for each node, where written
in bold, well those fields are exposed fields, i.e. they can be set when
the user is viewing the world.
An exposed field can be decomposed into the following three lines:
where fieldName can be any exposed field, i.e. fields written in bold in
the syntax boxes present in the tutorial for each node.
An exposed field declaration implies that the node is able to receive events,
eventIn, and generate events, eventOut. eventIn in an exposed field is
used to set the field's value. When the field's value is changed, the node
in which the field is defined will generate the respective eventOut.
Besides exposed fields, nodes can have other eventIn or eventOut fields,
however these fields are not present in the node's definition in a VRML
file, i.e. you don't write them when defining the node.
Some nodes have fields eventIn defined for some fields but not eventOut.
These fields are presented in the syntax boxes in italic. The eventIns
defined are set_name, where name is the fields name for those fields in
When an event occurs, the node which generated the event outputs a value
or set of values of a given data type depending on the type of event. When
one sends an event to a node, one is sending a value or set of values to
that node. The node determines what the event should do with the value
or values provided. In the VRML nodes, when a node receives an event it
alters one field, the field specified by the event.
How do I send an event to a node and how do I catch an event generated
by a node? There are two ways of doing this, using ROUTES
The next question is: when are events generated, other than those which
result in a field's value being changed? There are several possibilities:
Timers which generate events
at regular intervals
Touch Sensors which generate
events when the cursor is over objects within the same group
as the sensor.
Visibility Sensors which generate
events when shapes within the same group
as the sensor are visible to the user.
Dragging Sensors which generate
events when the user clicks the mouse and drags objects within the same
group as the sensor.
Proximity Sensors which generate
events when the user is within a predefined box.