Class GazeProvider
This class provides Gaze as an Input Source so users can interact with objects using their head.
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Input
Assembly: cs.temp.dll.dll
Syntax
public class GazeProvider : InputSystemGlobalHandlerListener, IMixedRealityGazeProviderHeadOverride, IMixedRealityEyeGazeProvider, IMixedRealityGazeProvider, IMixedRealityInputHandler, IMixedRealityBaseInputHandler, IEventSystemHandler
Properties
Enabled
Enable or disable the Component attached to the GameObjectReference
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
GameObjectReference
Get the GameObject reference for this Gaze Provider.
Declaration
public GameObject GameObjectReference { get; }
Property Value
Type | Description |
---|---|
GameObject |
GazeCursor
The Gaze Cursor for the provider.
Declaration
public IMixedRealityCursor GazeCursor { get; }
Property Value
Type | Description |
---|---|
IMixedRealityCursor |
GazeCursorPrefab
The prefab to be instantiated as the gaze cursor.
Declaration
public GameObject GazeCursorPrefab { set; }
Property Value
Type | Description |
---|---|
GameObject |
GazeDirection
Normal of the gaze.
Declaration
public Vector3 GazeDirection { get; }
Property Value
Type | Description |
---|---|
Vector3 |
GazeInputSource
The Gaze Input Source for the provider.
Declaration
public IMixedRealityInputSource GazeInputSource { get; }
Property Value
Type | Description |
---|---|
IMixedRealityInputSource |
GazeOrigin
Origin of the gaze.
Declaration
public Vector3 GazeOrigin { get; }
Property Value
Type | Description |
---|---|
Vector3 |
GazePointer
The Gaze Pointer for the provider.
Declaration
public IMixedRealityPointer GazePointer { get; }
Property Value
Type | Description |
---|---|
IMixedRealityPointer |
GazeTarget
The game object that is currently being gazed at, if any.
Declaration
public GameObject GazeTarget { get; }
Property Value
Type | Description |
---|---|
GameObject |
HeadMovementDirection
The current head movement direction.
Declaration
public Vector3 HeadMovementDirection { get; }
Property Value
Type | Description |
---|---|
Vector3 |
HeadVelocity
The current head velocity.
Declaration
public Vector3 HeadVelocity { get; }
Property Value
Type | Description |
---|---|
Vector3 |
HitInfo
HitInfo property gives access to information at the object being gazed at, if any.
Declaration
public MixedRealityRaycastHit HitInfo { get; }
Property Value
Type | Description |
---|---|
MixedRealityRaycastHit |
HitNormal
Normal of the point at which the gaze manager hit an object. If no object is currently being hit, this will return the previous normal.
Declaration
public Vector3 HitNormal { get; }
Property Value
Type | Description |
---|---|
Vector3 |
HitPosition
Position at which the gaze manager hit an object. If no object is currently being hit, this will use the last hit distance.
Declaration
public Vector3 HitPosition { get; }
Property Value
Type | Description |
---|---|
Vector3 |
IsEyeCalibrationValid
Whether the user is eye calibrated. It returns 'null', if the value has not yet received data from the eye tracking system.
Declaration
public bool? IsEyeCalibrationValid { get; }
Property Value
Type | Description |
---|---|
Nullable<Boolean> |
IsEyeTrackingDataValid
Whether eye tracking data is available. It may be unavailable due to timeout or lack of tracking hardware or permissions.
Declaration
public bool IsEyeTrackingDataValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsEyeTrackingEnabled
If true, eye-based tracking will be used when available.
Declaration
public bool IsEyeTrackingEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
The usage of eye-based tracking depends on having the Gaze Input permission set and user approved, along with proper device eye calibration. This will fallback to head-based gaze when eye-based tracking is not available.
IsEyeTrackingEnabledAndValid
Whether eye tracking data is currently been used for gaze rather then head pose. Eye Tracking must be both enabled and have valid data.
Declaration
public bool IsEyeTrackingEnabledAndValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
LatestEyeGaze
The most recent eye tracking ray
Declaration
public Ray LatestEyeGaze { get; }
Property Value
Type | Description |
---|---|
Ray |
Timestamp
DateTime in UTC when the signal was last updated.
Declaration
public DateTime Timestamp { get; }
Property Value
Type | Description |
---|---|
DateTime |
UseHeadGazeOverride
If true, platform-specific head gaze override is used, when available. Otherwise, the center of the camera frame is used by default.
Declaration
public bool UseHeadGazeOverride { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnInputDown(InputEventData)
Declaration
public void OnInputDown(InputEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
InputEventData | eventData |
OnInputUp(InputEventData)
Declaration
public void OnInputUp(InputEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
InputEventData | eventData |
OverrideHeadGaze(Vector3, Vector3)
Allows head gaze to be overridden, typically by platform-specific values.
Declaration
public void OverrideHeadGaze(Vector3 position, Vector3 forward)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Vector3 | forward |
RegisterHandlers()
Overload this method to specify, which global events component wants to listen to. Use RegisterHandler API of InputSystem
Declaration
protected override void RegisterHandlers()
Overrides
SetGazeCursor(GameObject)
Set the gaze cursor.
Declaration
public void SetGazeCursor(GameObject cursor)
Parameters
Type | Name | Description |
---|---|---|
GameObject | cursor |
Start()
Declaration
protected override void Start()
Overrides
UnregisterHandlers()
Overload this method to specify, which global events component should stop listening to. Use UnregisterHandler API of InputSystem
Declaration
protected override void UnregisterHandlers()
Overrides
UpdateEyeGaze(IMixedRealityEyeGazeDataProvider, Ray, DateTime)
Tells the eye gaze provider that eye gaze has updated.
Declaration
public void UpdateEyeGaze(IMixedRealityEyeGazeDataProvider provider, Ray eyeRay, DateTime timestamp)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityEyeGazeDataProvider | provider | The provider raising the event. |
Ray | eyeRay | |
DateTime | timestamp |
Remarks
This method is to be called by implementations of the IMixedRealityEyeGazeDataProvider interface, not by application code.
UpdateEyeTrackingStatus(IMixedRealityEyeGazeDataProvider, Boolean)
Tells the eye gaze provider about the eye tracking status (e.g., whether the user is calibrated);
Declaration
public void UpdateEyeTrackingStatus(IMixedRealityEyeGazeDataProvider provider, bool userIsEyeCalibrated)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityEyeGazeDataProvider | provider | The provider raising the event. |
Boolean | userIsEyeCalibrated | Boolean whether the user is eye calibrated or not. |
Remarks
Note that this function is not invoked when eye tracking is lost - use IsEyeTrackingAvailable to detect when eye tracking is lost.
UpdateGazeInfoFromHit(MixedRealityRaycastHit)
Notifies this gaze provider of its new hit details.
Declaration
public void UpdateGazeInfoFromHit(MixedRealityRaycastHit raycastHit)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityRaycastHit | raycastHit |
Remarks
For components that care where the user's looking, we need to separately update the gaze info even if gaze isn't used for focus.