H3D API
2.4.1
|
The ProximitySensor node generates events when the viewer enters, exits, and moves within a region in space (defined by a box). More...
#include <H3D/ProximitySensor.h>
Classes | |
class | SetTime |
The SetBoolean class is specialize to set the value of either the enterTime or exitTime field in the ProximitySensor node it resides in, depending on the value that is is given. More... | |
Public Member Functions | |
ProximitySensor (Inst< SFNode > _metadata=0, Inst< SFVec3f > _center=0, Inst< SFBool > _enabled=0, Inst< SFVec3f > _size=0, Inst< SFTime > _enterTime=0, Inst< SFTime > _exitTime=0, Inst< SFBool > _isActive=0, Inst< SFVec3f > _centerOfRotation_changed=0, Inst< SFRotation > _orientation_changed=0, Inst< SFVec3f > _position_changed=0) | |
Constructor. | |
virtual void | traverseSG (TraverseInfo &ti) |
Traverse function. | |
![]() | |
X3DEnvironmentalSensorNode (Inst< SFNode > _metadata=0, Inst< SFVec3f > _center=0, Inst< SFBool > _enabled=0, Inst< SFVec3f > _size=0, Inst< SFTime > _enterTime=0, Inst< SFTime > _exitTime=0, Inst< SFBool > _isActive=0) | |
Constructor. | |
![]() | |
X3DSensorNode (Inst< SFBool > _enabled=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isActive=0) | |
Constructor. | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Public Attributes | |
H3DUniquePtr< SFVec3f > | centerOfRotation_changed |
The centerOfRotation_changed field sends events whenever the user is contained within the proximity region and the center of rotation of the viewer for EXAMINE mode changes with respect to the ProximitySensor node's coordinate system. More... | |
H3DUniquePtr< SFRotation > | orientation_changed |
The orientation_changed fields send events whenever the user is contained within the proximity region and the orientation of the viewer changes with respect to the ProximitySensor node's coordinate system including enter and exit times. More... | |
H3DUniquePtr< SFVec3f > | position_changed |
The position_changed fields send events whenever the user is contained within the proximity region and the position of the viewer changes with respect to the ProximitySensor node's coordinate system including enter and exit times. More... | |
H3DUniquePtr< SetTime > | set_time |
Sets enterTime if the set_boolean value is set to TRUE else sets exitTime. More... | |
TraverseInfo * | prev_travinfoadr |
Adress of traverseInfo only interested in adress, what it points to will be invalid. | |
![]() | |
H3DUniquePtr< SFVec3f > | center |
Center gives the space location of the box. More... | |
H3DUniquePtr< SFVec3f > | size |
Size gives the size of the box (width=x, height=y, depth=z) More... | |
H3DUniquePtr< SFTime > | enterTime |
enterTime More... | |
H3DUniquePtr< SFTime > | exitTime |
exitTime More... | |
![]() | |
H3DUniquePtr< SFBool > | enabled |
If enabled is true the sensor node is enabled otherwise it is disabled and will not generate any output. More... | |
H3DUniquePtr< SFBool > | isActive |
A sensor is active when some special conditions are fulfilled and it will then generate extra output. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
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 centerOfRotation_changed field sends events whenever the user is contained within the proximity region and the center of rotation of the viewer for EXAMINE mode changes with respect to the ProximitySensor node's coordinate system. This may result when the bound Viewpoint nodes's center of rotation changes, when a new viewpoint is bound, when the user changes the center of rotation through the browser's user interface, or from changes to the ProximitySensor node's coordinate system. centerOfRotation_changed events are only generated when the currently bound NavigationInfo node includes LOOKAT navigation.
The position_changed and orientation_changed fields 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. For non-overlapping bounding boxes, position_changed and orientation_changed events are calculated relative to the coordinate system associated with the bounding box in which the proximity was detected. 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 an X3D 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.
Examples:
H3DUniquePtr< SFVec3f > H3D::ProximitySensor::centerOfRotation_changed |
The centerOfRotation_changed field sends events whenever the user is contained within the proximity region and the center of rotation of the viewer for EXAMINE mode changes with respect to the ProximitySensor node's coordinate system.
Access type: outputOnly
Referenced by traverseSG().
H3DUniquePtr< SFRotation > H3D::ProximitySensor::orientation_changed |
The orientation_changed fields send events whenever the user is contained within the proximity region and the orientation of the viewer changes with respect to the ProximitySensor node's coordinate system including enter and exit times.
Access type: outputOnly
Referenced by traverseSG().
H3DUniquePtr< SFVec3f > H3D::ProximitySensor::position_changed |
The position_changed fields send events whenever the user is contained within the proximity region and the position of the viewer changes with respect to the ProximitySensor node's coordinate system including enter and exit times.
Access type: outputOnly
Referenced by traverseSG().
H3DUniquePtr< SetTime > H3D::ProximitySensor::set_time |
Sets enterTime if the set_boolean value is set to TRUE else sets exitTime.
Only accessible in C++.
Referenced by ProximitySensor().