Lighthouse3d.com

Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Group
Transform
Collision
Anchor
Billboard
Switch
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

Page not found » Lighthouse3d.com
Help end child hunger

Error 404 - Not Found

Sorry, the page that you are looking for does not exist.

Events


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 type.

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:

eventIn set_fieldName
field fieldName
eventOut fieldName_changed
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 italics.

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 and scripts.

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.