Home Hierarchy Members Alphabetical Related Pages

ProximitySensor Class Reference
[Standard Node Types]

#include <proximitysensor.h>

Inherits Node.

Inheritance diagram for ProximitySensor:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ProximitySensor (const char *name="")
virtual ~ProximitySensor ()
virtual unsigned int nbFields () const
virtual FieldHandle field (const std::string &n)
virtual FieldHandle field (const unsigned int i)
virtual bool isSetToDefaultValue (const unsigned int i) const
virtual unsigned int nbEventsIn () const
virtual EventInHandle eventIn (const std::string &n)
virtual EventInHandle eventIn (const unsigned int i)
virtual unsigned int nbEventsOut () const
virtual EventOutHandle eventOut (const std::string &n)
virtual EventOutHandle eventOut (const unsigned int i)
const char * typeName () const
virtual Nodeduplicate () const
virtual Nodeduplicate (std::map< const Node *, Node * > &) const

Public Attributes

Exposed Fields
A field that is capable of receiving events via an eventIn to change its value(s), and generating events via an eventOut when its value(s) change.

SFVec3f center
SFVec3f size
SFBool enabled
Events In
EventIn< SFVec3fset_center
EventIn< SFVec3fset_size
EventIn< SFBoolset_enabled
Events Out
EventOut< SFBoolisActive
EventOut< SFVec3fposition_changed
EventOut< SFRotationorientation_changed
EventOut< SFTimeenterTime
EventOut< SFTimeexitTime
EventOut< SFVec3fcenter_changed
EventOut< SFVec3fsize_changed
EventOut< SFBoolenabled_changed

Detailed Description

Here is the documentation for this node type, from the ISO standard.

+6.57 ProximitySensor

The ProximitySensor node generates events when the viewer enters, exits, and moves within a region in space (defined by a box). A proximity sensor is enabled or disabled by sending it an enabled event with a value of TRUE or FALSE. A disabled sensor does not send events.

A ProximitySensor node generates isActive TRUE/FALSE events as the viewer enters and exits the rectangular box defined by its center and size fields. Browsers shall interpolate viewer positions and timestamp the isActive events with the exact time the viewer first intersected the proximity region. The center field defines the centre point of the proximity region in object space. The size field specifies a vector which defines the width (x), height (y), and depth (z) of the box bounding the region. The components of the size field shall be greater than or equal to zero. ProximitySensor nodes are affected by the hierarchical transformations of their parents.

The enterTime event is generated whenever the isActive TRUE event is generated (user enters the box), and exitTime events are generated whenever an isActive FALSE event is generated (user exits the box).

The position_changed and orientation_changed eventOuts send events whenever the user is contained within the proximity region and the position and orientation of the viewer changes with respect to the ProximitySensor node's coordinate system including enter and exit times. The viewer movement may be a result of a variety of circumstances resulting from browser navigation, ProximitySensor node's coordinate system changes, or bound Viewpoint node's position or orientation changes.

Each ProximitySensor node behaves independently of all other ProximitySensor nodes. Every enabled ProximitySensor node that is affected by the viewer's movement receives and sends events, possibly resulting in multiple ProximitySensor nodes receiving and sending events simultaneously. Unlike TouchSensor nodes, there is no notion of a ProximitySensor node lower in the scene graph "grabbing" events.

Instanced (DEF/USE) ProximitySensor nodes use the union of all the boxes to check for enter and exit. A multiply instanced ProximitySensor node will detect enter and exit for all instances of the box and send enter/exit events appropriately. However, the results are undefined if the any of the boxes of a multiply instanced ProximitySensor node overlap.

A ProximitySensor node that surrounds the entire world has an enterTime equal to the time that the world was entered and can be used to start up animations or behaviours as soon as a world is loaded. A ProximitySensor node with a box containing zero volume (i.e., any size field element of 0.0) cannot generate events. This is equivalent to setting the enabled field to FALSE.

A ProximitySensor read from a VRML file shall generate isActive TRUE, position_changed, orientation_changed and enterTime events if the sensor is enabled and the viewer is inside the proximity region. A ProximitySensor inserted into the transformation hierarchy shall generate isActive TRUE, position_changed, orientation_changed and enterTime events if the sensor is enabled and the viewer is inside the proximity region. A ProximitySensor removed from the transformation hierarchy shall generate isActive FALSE, position_changed, orientation_changed and exitTime events if the sensor is enabled and the viewer is inside the proximity region.

--- VRML separator bar ---


Constructor & Destructor Documentation

ProximitySensor const char *  name = ""  ) 
 

Construct a node with all its fields set to default value, which is equivalent to the code below:

  center.setXYZ(0,0,0);
  size.setXYZ(0,0,0);
  enabled = true;

~ProximitySensor  )  [virtual]
 

Virtual destructor, does nothing


Member Function Documentation

wrl::Node * duplicate std::map< const Node *, Node * > &   )  const [virtual]
 

Implements Node.

wrl::Node * duplicate  )  const [virtual]
 

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

wrl::Node::EventInHandle eventIn const unsigned int  n  )  [virtual]
 

Return a handle on the i th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventInHandle eventIn const std::string &  n  )  [virtual]
 

Return a handle on the event in named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

  • set_center
  • set_size
  • set_enabled

Implements Node.

wrl::Node::EventOutHandle eventOut const unsigned int  n  )  [virtual]
 

Return a handle on the i th event out of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

  • 0 : isActive
  • 1 : position_changed
  • 2 : orientation_changed
  • 3 : enterTime
  • 4 : exitTime
  • 5 : center_changed
  • 6 : size_changed
  • 7 : enabled_changed This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventOutHandle eventOut const std::string &  n  )  [virtual]
 

Return a handle on the event out named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

  • isActive
  • position_changed
  • orientation_changed
  • enterTime
  • exitTime
  • center_changed
  • size_changed
  • enabled_changed

Implements Node.

wrl::Node::FieldHandle field const unsigned int  n  )  [virtual]
 

Return a handle on the i th field of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

  • 0 : center
  • 1 : size
  • 2 : enabled This function is useful, with nbFields() if you want to traverse all fields of a Node.

Implements Node.

wrl::Node::FieldHandle field const std::string &  n  )  [virtual]
 

Return a handle on the field named n of the node or a "unknown" typed handle if there is no such field. Valid names are:

  • center
  • size
  • enabled

Implements Node.

bool isSetToDefaultValue const unsigned int  i  )  const [virtual]
 

Implements Node.

unsigned int nbEventsIn  )  const [inline, virtual]
 

Returns the number of events in for this node type.

Implements Node.

unsigned int nbEventsOut  )  const [inline, virtual]
 

Returns the number of events out for this node type.

Implements Node.

unsigned int nbFields  )  const [inline, virtual]
 

Returns the number of fields (exposed or not) for this node type.

Implements Node.

const char * typeName  )  const [inline, virtual]
 

Returns "ProximitySensor". Useful for printing.

Implements Node.


Member Data Documentation

SFVec3f center
 

See Detailed Description for meaning of this field. Default value is set to

       center.setXYZ(0,0,0);

EventOut<SFVec3f> center_changed
 

Changed event associated to exposedField center

SFBool enabled
 

See Detailed Description for meaning of this field. Default value is set to

       enabled = true;

EventOut<SFBool> enabled_changed
 

Changed event associated to exposedField enabled

EventOut<SFTime> enterTime
 

See Detailed Description for meaning of this event.

EventOut<SFTime> exitTime
 

See Detailed Description for meaning of this event.

EventOut<SFBool> isActive
 

See Detailed Description for meaning of this event.

EventOut<SFRotation> orientation_changed
 

See Detailed Description for meaning of this event.

EventOut<SFVec3f> position_changed
 

See Detailed Description for meaning of this event.

EventIn<SFVec3f> set_center
 

Set event associated to exposedField center

EventIn<SFBool> set_enabled
 

Set event associated to exposedField enabled

EventIn<SFVec3f> set_size
 

Set event associated to exposedField size

SFVec3f size
 

See Detailed Description for meaning of this field. Default value is set to

       size.setXYZ(0,0,0);

EventOut<SFVec3f> size_changed
 

Changed event associated to exposedField size


Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!