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, 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
Boolean to check whether the user went through the eye tracking calibration. Initially the parameter will return null until it has received valid information from the eye tracking system.
Declaration
public bool? IsEyeCalibrationValid { get; }
Property Value
Type | Description |
---|---|
Nullable<Boolean> |
IsEyeGazeValid
Whether eye gaze is valid. It may be invalid due to timeout or lack of tracking hardware or permissions.
Declaration
public bool IsEyeGazeValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
Timestamp
DateTime in UTC when the signal was last updated.
Declaration
public DateTime Timestamp { get; }
Property Value
Type | Description |
---|---|
DateTime |
UseEyeTracking
If true, eye-based tracking will be used when available.
Declaration
public bool UseEyeTracking { 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.
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 |
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)
Declaration
public void UpdateEyeGaze(IMixedRealityEyeGazeDataProvider provider, Ray eyeRay, DateTime timestamp)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityEyeGazeDataProvider | provider | |
Ray | eyeRay | |
DateTime | timestamp |
UpdateEyeTrackingStatus(IMixedRealityEyeGazeDataProvider, Boolean)
Declaration
public void UpdateEyeTrackingStatus(IMixedRealityEyeGazeDataProvider provider, bool userIsEyeCalibrated)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityEyeGazeDataProvider | provider | |
Boolean | userIsEyeCalibrated |
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.