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.
    #VRML V2.0 utf8 
    Group { 
    }
    ROUTE vs.enterTime TO ac.set_startTime