|
|
VRML Script Tutorial
Full list
VRML Interactive Tutorial
Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance
Let there be Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Interpolators
Let the Music Play
Bindable Nodes
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes
|
|
|
|
VisibilitySensor Node
The VisibilitySensor node is used to detect visibility changes in a virtual box, generating
events when the visibility status changes. This sensor does not relate
to the shapes defined within the same group,
i.e. it does not detect if a shape within a group is visible or not. The
Visibility sensor does not detect if the box is hidden from view due to
other shapes in the scene. The sensor behaves as if there were no other
shapes being drawn.
The following fields are present:
center: The center of the rectangular box
size: The dimensions of the rectangular box
enabled: determines the status of the sensor.
The following events are generated by this sensor:
enterTime: outputs the time when the box becomes visible
exitTime: outputs the time when the box stops being visible
isActive: outputs TRUE when the box becomes visible, and FALSE
when the box becomes invisible
Syntax:
|
VisibilitySensor { |
enabled TRUE
center 0 0 0
size 0 0 0
|
} |
|
When defining several VisibilitySensor inside nested groups, all the sensors
will generate events when the respective boxes are visible.
Example of a VisibilitySensor to play a sound. When the Shape becomes visible
you should hear a sound.
The following source code describes a group
with a Visibility Sensor, a Shape and a Sound.
Example:
-
#VRML V2.0 utf8
Group {
-
children [
-
DEF vs VisibilitySensor { size 1 1 1}
-
Sound { source DEF ac AudioClip { loop FALSE url "sfx.mid"
} }
-
Shape { geometry Box { size 1 1 1 }
-
]
}
ROUTE vs.enterTime TO ac.set_startTime
|