Skip to content

Area Of Interest Ray

eisclimber edited this page Jan 18, 2024 · 1 revision

Area Of Interest Ray

class in ExPresSXR.Interaction / Extends UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable
GameObject instantiable via ExPresSXR/Eye Tracking/Area Of Interest Ray; Component added via Component Menu

Description

Casts a ray that can be used to detect 'AreaOfInterests'-Components, mostly used for EyeTracking but can be done with arbitrary Position- and Rotation-InputActions.
Supports bouncing (e.g. with Mirrors). The number of bounces is determined by '_numAOIBounces'. For objects to bounce they must be in the 'AreaOfInterestBouncer'-Layer and have an 'AreaOfInterestRayBouncer'-Component attached to them.

Should be added as a child of the Rig itself as the head's position is relative to the rig's origin.

Members

Editor Properties

  • InputActionReference _eyePositionRef: The InputActionRef that provides the value of the eye's position.
  • InputActionReference _eyeRotationRef: The InputActionRef that provides the value of the eye's rotation.
  • int _numAOIBounces: If set to a value greater than 0 will allow _numAOIBounces until hitting an AOIArea. For a GameObject to bounce the 'AreaOfInterestRayBouncer'-Component must be added and it's layer be set to 'AreaOfInterestBouncer'.
  • LayerMask _layerMask: LayerMask for detecting AOIs and AOIBouncers.

Public Properties

  • string focusedAoiId: The if of the currently detected AOI. Will be NO_AOI_DETECTED_ID if none was detected.
  • Vector3 currentEyePos: Position of the eye in world space.
  • Vector3 currentEyeDir: Direction of the eye in world space.
  • List<Vector3> bounceTracePath: List of Points that traces the current raycast. First entry will be the currentEyePos. If it's length is more than one the last entry will be the hit point on the AOI. Intermediate points are bounces. The length of the list is in range [1, _numAOIBounces + 1].

Constants

  • int DEFAULT_AOI_LAYER_MASK = 1536: Layer mask for AreaOfInterest and AreaOfInterestbouncers.
  • float GIZMOS_RAY_MAX_LENGTH = 5.0f: Length of the Gizmos Ray when no AOI is hit.
  • float GIZMOS_CUBE_SIZE = 0.05f: Size of the Gizmo cube that is drawn at AOI bounces and hits.
  • string NO_AOI_DETECTED_ID = "None": String specifying that no AOI was hit.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally