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.
    #VRML V2.0 utf8 
    Group { 
    }
    ROUTE ps.isActive TO sl.set_on