Class XRGazeInteractor
Interactor used for interacting with interactables via gaze. This extends XRRayInteractor and uses the same ray cast technique to update a current set of valid targets.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/XR Gaze Interactor", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.5/api/UnityEngine.XR.Interaction.Toolkit.XRGazeInteractor.html")]
public class XRGazeInteractor : XRRayInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRActivateInteractor, IXRInteractor, IAdvancedLineRenderable, ILineRenderable, IUIHoverInteractor, IUIInteractor, IXRRayProvider, IXRScaleValueProvider
Properties
clampGazeAssistanceDistanceScaling
If true, the gazeAssistanceSnapVolume scale will be clamped at gazeAssistanceDistanceScalingClampValue.
Declaration
public bool clampGazeAssistanceDistanceScaling { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
gazeAssistanceCalculation
Defines the way the gaze assistance calculates and sizes the assistance area.
Declaration
public XRGazeInteractor.GazeAssistanceCalculation gazeAssistanceCalculation { get; set; }
Property Value
Type | Description |
---|---|
XRGazeInteractor.GazeAssistanceCalculation |
See Also
gazeAssistanceColliderFixedSize
The size of the gazeAssistanceSnapVolume collider when gazeAssistanceCalculation is FixedSize.
Declaration
public float gazeAssistanceColliderFixedSize { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
gazeAssistanceColliderScale
The scale of the gazeAssistanceSnapVolume when gazeAssistanceCalculation is FixedSize or ColliderSize .
Declaration
public float gazeAssistanceColliderScale { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
gazeAssistanceDistanceScaling
If true, the gazeAssistanceSnapVolume will also scale based on the distance from the XRGazeInteractor.
Declaration
public bool gazeAssistanceDistanceScaling { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
gazeAssistanceDistanceScalingClampValue
The value the assistance collider scale will be clamped to if clampGazeAssistanceDistanceScaling is true.
Declaration
public float gazeAssistanceDistanceScalingClampValue { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
gazeAssistanceSnapVolume
The XRInteractableSnapVolume to place where this XRGazeInteractor hits a valid target for gaze assistance. If not set, Unity will create one by default.
Declaration
public XRInteractableSnapVolume gazeAssistanceSnapVolume { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableSnapVolume |
Remarks
Only SphereCollider and BoxCollider are supported for automatic dynamic scaling of the snapCollider.
See Also
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
See Also
GetHoverTimeToSelect(IXRInteractable)
Gets the number of seconds for which this interactor must hover over the interactable to select it if hoverToSelect is enabled.
Declaration
protected override float GetHoverTimeToSelect(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The interactable to get the duration for. |
Returns
Type | Description |
---|---|
float | Returns the number of seconds for which this Interactor must hover over an Interactable to select it. |
Overrides
See Also
GetTimeToAutoDeselect(IXRInteractable)
Gets the number of seconds for which this interactor will keep the interactable selected before automatically deselecting it.
Declaration
protected override float GetTimeToAutoDeselect(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The interactable to get the duration for. |
Returns
Type | Description |
---|---|
float | Returns the number of seconds for which this Interactor will keep an Interactable selected before automatically deselecting it. |
Overrides
See Also
PreprocessInteractor(UpdatePhase)
The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor before interaction events occur. Interactors should use this method to do tasks like determine their valid targets.
Declaration
public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Overrides
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
UpdateSnapVolumeInteractable(IXRInteractable)
Updates the gazeAssistanceSnapVolume based on a target interactable.
Declaration
protected virtual void UpdateSnapVolumeInteractable(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The IXRInteractable this XRGazeInteractor is processing and using to update the gazeAssistanceSnapVolume. |