XdkWrl: ProximitySensor Class Reference

Home | Hierarchy | Members | Alphabetical | Related Pages

# ProximitySensor Class Reference
[Standard Node Types]

`#include <proximitysensor.h>`

Inherits Node.

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 (unsigned int i)
virtual bool | isSetToDefaultValue (unsigned int i) const
virtual unsigned int | nbEventsIn () const
virtual EventInHandle | eventIn (const std::string &n)
virtual EventInHandle | eventIn (unsigned int i)
virtual unsigned int | nbEventsOut () const
virtual EventOutHandle | eventOut (const std::string &n)
virtual EventOutHandle | eventOut (unsigned int i)
const char * | typeName () const
virtual Node * | duplicate () const
virtual Node * | duplicate (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< SFVec3f > | set_center
EventIn< SFVec3f > | set_size
EventIn< SFBool > | set_enabled
Events Out
EventOut< SFBool > | isActive
EventOut< SFVec3f > | position_changed
EventOut< SFRotation > | orientation_changed
EventOut< SFTime > | enterTime
EventOut< SFTime > | exitTime
EventOut< SFVec3f > | center_changed
EventOut< SFVec3f > | size_changed
EventOut< SFBool > | enabled_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.

## 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

unsigned int nbFields | ( |  | ) | const`[inline, virtual]`

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

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.

wrl::Node::FieldHandle field | ( | 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.

bool isSetToDefaultValue | ( | 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.

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::EventInHandle eventIn | ( | 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.

unsigned int nbEventsOut | ( |  | ) | const`[inline, virtual]`

Returns the number of events out for this node type.

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::EventOutHandle eventOut | ( | 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.

const char * typeName | ( |  | ) | const`[inline, virtual]`

Returns `"ProximitySensor"`. Useful for printing.

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.

virtual Node* duplicate | ( | std::map< const Node *, Node * > & |  | ) | const`[virtual]`

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);

SFVec3f size

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

           size.setXYZ(0,0,0);

SFBool enabled

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

           enabled = true;

EventIn<SFVec3f> set_center

Set event associated to exposedField center

EventIn<SFVec3f> set_size

Set event associated to exposedField size

EventIn<SFBool> set_enabled

Set event associated to exposedField enabled

EventOut<SFBool> isActive

See Detailed Description for meaning of this event.

EventOut<SFVec3f> position_changed

See Detailed Description for meaning of this event.

EventOut<SFRotation> orientation_changed

See Detailed Description for meaning of this event.

EventOut<SFTime> enterTime

See Detailed Description for meaning of this event.

EventOut<SFTime> exitTime

See Detailed Description for meaning of this event.

EventOut<SFVec3f> center_changed

Changed event associated to exposedField center

EventOut<SFVec3f> size_changed

Changed event associated to exposedField size

EventOut<SFBool> enabled_changed

Changed event associated to exposedField enabled

Generated on 5 Jan 2007 with version 1.5.1. |