Post

ProximitySensor

ProximitySensor

Overview

ProximitySensor generates events when the viewer enters, exits and moves within a region of space (defined by a box).

The ProximitySensor node belongs to the EnvironmentalSensor component and requires at least level 1, its default container field is children. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
5
+ X3DNode
  + X3DChildNode
    + X3DSensorNode
      + X3DEnvironmentalSensorNode
        + ProximitySensor

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFString [in, out] description “”

Author-provided prose that describes intended purpose of the node.

Hint

  • Many XML tools substitute XML character references for special characters automatically if needed within an attribute value (such as & for & ampersand character, or " for “ quotation-mark character).

SFBool [in, out] enabled TRUE

Enables/disables node operation.

SFVec3f [in, out] size 0 0 0 [0,∞)

size of Proximity box around center location, oriented within local transformation frame.

Hint

  • size 0 0 0 is same as enabled false.

SFVec3f [in, out] center 0 0 0 (-∞,∞)

Position offset from origin of local coordinate system.

SFTime [out] enterTime

Time event generated when user’s camera enters the box.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFTime [out] exitTime

Time event generated when user’s camera exits the box.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [out] isActive

isActive true/false events are sent as viewer enters/exits Proximity box. isActive=true when viewer enters Proximity box, isActive=false when viewer exits Proximity box.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFVec3f [out] position_changed

Sends translation event relative to center.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFRotation [out] orientation_changed

Sends rotation event relative to center.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFVec3f [out] centerOfRotation_changed

Sends changed centerOfRotation values, likely caused by user interaction.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

Advice

Hints

  • Multiple USEd instances are cumulative, but avoid overlaps.
  • Can first use Transform to relocate/reorient box.
  • Surround entire world to start behaviors once scene is loaded.

Example

See Also

This post is licensed under CC BY 4.0 by the author.