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.

ProximitySensor Node


The ProximitySensor node is a way of providing interactivity with the user. The sensor generates events when the user enters, leaves or moves in a defined rectangular box. 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 close to the user or not.

This node has the following fields:
  • enabled specifies the status of the sensor;
  • center determines the center of the rectangular box;
  • size specifies the size of the box.
  • The isActive event is generated with the value TRUE by this node when the field is enabled and the mouse moves from a position outside the box to a position inside the box. A value FALSE is provided by this event when the sensor is enabled and the mouse leaves the box.

    An event enterTime is generated when the user enters the box, the event exitTime is generated when the user leaves the box.

    When the mouse is inside, enters or leaves the box, the following events are generated when the mouse moves:
  • position_changed: Provides the 3D position of the user in the sensor's coordinate system.
  • orientation_changed: provides the users orientation.


  • Syntax:
    ProximitySensor {
    enabled TRUE
    center 0 0 0
    size 0 0 0
    }


    When defining several ProximitySensor inside nested groups, all the sensors will generate events when the user is inside the respective boxes.

    Example of a ProximitySensor to turn on and off a light. The light is turned on as soon as the user enters the Box, and off when the user leaves the box:

    The following source code describes a group with a Visibility Sensor and a Sound.

    Example:
    #VRML V2.0 utf8
    Group {
      children [
        DEF ps ProximitySensor { size 4 4 4}
        DEF sl SpotLight { on FALSE location 0 0 4}
        Shape { appearance Appearance {material Material {}}
          geometry Sphere {}
        }
      ]
    }
    ROUTE ps.isActive TO sl.set_on