Class XRPokeInteractor
Interactor used for interacting with interactables through poking.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
[AddComponentMenu("XR/XR Poke Interactor", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.4/api/UnityEngine.XR.Interaction.Toolkit.XRPokeInteractor.html")]
public class XRPokeInteractor : XRBaseInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRInteractor, IUIHoverInteractor, IUIInteractor
Properties
debugVisualizationsEnabled
Denotes whether or not debug visuals are enabled for this poke interactor. Debug visuals include two spheres to display whether or not hover and select colliders have collided.
Declaration
public bool debugVisualizationsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
enableUIInteraction
Gets or sets whether this Interactor is able to affect UI.
Declaration
public bool enableUIInteraction { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
physicsLayerMask
Physics layer mask used for limiting poke sphere overlap.
Declaration
public LayerMask physicsLayerMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
physicsTriggerInteraction
Determines whether the poke sphere overlap will hit triggers.
Declaration
public QueryTriggerInteraction physicsTriggerInteraction { get; set; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
pokeDepth
The depth threshold within which an interaction can begin to be evaluated as a poke.
Declaration
public float pokeDepth { get; set; }
Property Value
Type | Description |
---|---|
Single |
pokeHoverRadius
The radius threshold within which an interaction can be evaluated as a poke hover.
Declaration
public float pokeHoverRadius { get; set; }
Property Value
Type | Description |
---|---|
Single |
pokeInteractionOffset
Distance along the poke interactable interaction axis that allows for a poke to be triggered sooner/with less precision.
Declaration
public float pokeInteractionOffset { get; set; }
Property Value
Type | Description |
---|---|
Single |
pokeSelectWidth
The width threshold within which an interaction can be evaluated as a poke select.
Declaration
public float pokeSelectWidth { get; set; }
Property Value
Type | Description |
---|---|
Single |
pokeWidth
The width threshold within which an interaction can begin to be evaluated as a poke.
Declaration
public float pokeWidth { get; set; }
Property Value
Type | Description |
---|---|
Single |
requirePokeFilter
Denotes whether or not valid targets will only include objects with a poke filter.
Declaration
public bool requirePokeFilter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
uiHoverEntered
The event that is called when the Interactor begins hovering over a UI element.
Declaration
public UIHoverEnterEvent uiHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
UIHoverEnterEvent |
Implements
Remarks
The UIHoverEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
uiHoverExited
The event that is called when this Interactor ends hovering over a UI element.
Declaration
public UIHoverExitEvent uiHoverExited { get; set; }
Property Value
Type | Description |
---|---|
UIHoverExitEvent |
Implements
Remarks
The UIHoverEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
CanSelect(IXRSelectInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
public override bool CanSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the Interactable can be selected this frame. |
Overrides
See Also
GetValidTargets(List<IXRInteractable>)
Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).
Declaration
public override void GetValidTargets(List<IXRInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<IXRInteractable> | targets | The results list to populate with Interactables that are valid for selection or hover. |
Overrides
Remarks
When implementing this method, Unity expects you to clear targets
before adding to it.
OnDestroy()
See MonoBehaviour.
Declaration
protected override void OnDestroy()
Overrides
OnDisable()
See MonoBehaviour.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
See MonoBehaviour.
Declaration
protected override void OnEnable()
Overrides
OnUIHoverEntered(UIHoverEventArgs)
The XRUIInputModule calls this method when the Interactor begins hovering over a UI element.
Declaration
protected virtual void OnUIHoverEntered(UIHoverEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
UIHoverEventArgs | args | Event data containing the UI element that is being hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnUIHoverExited(UIHoverEventArgs)
The XRUIInputModule calls this method when the Interactor ends hovering over a UI element.
Declaration
protected virtual void OnUIHoverExited(UIHoverEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
UIHoverEventArgs | args | Event data containing the UI element that is no longer hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
PreprocessInteractor(XRInteractionUpdateOrder.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
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor after interaction events occur.
Declaration
public override void ProcessInteractor(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
TryGetUIModel(out TrackedDeviceModel)
Attempts to retrieve the current UI Model.
Declaration
public bool TryGetUIModel(out TrackedDeviceModel model)
Parameters
Type | Name | Description |
---|---|---|
TrackedDeviceModel | model | The returned model that reflects the UI state of this Interactor. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the model was able to retrieved. Otherwise, returns false. |
Implements
UpdateUIModel(ref TrackedDeviceModel)
Updates the current UI Model to match the state of the Interactor.
Declaration
public virtual void UpdateUIModel(ref TrackedDeviceModel model)
Parameters
Type | Name | Description |
---|---|---|
TrackedDeviceModel | model | The returned model that will match this Interactor. |
Implements
Explicit Interface Implementations
IUIHoverInteractor.OnUIHoverEntered(UIHoverEventArgs)
The XRUIInputModule calls this method when the Interactor begins hovering over a UI element.
Declaration
void IUIHoverInteractor.OnUIHoverEntered(UIHoverEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
UIHoverEventArgs | args | Event data containing the UI element that is being hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IUIHoverInteractor.OnUIHoverExited(UIHoverEventArgs)
The XRUIInputModule calls this method when the Interactor ends hovering over a UI element.
Declaration
void IUIHoverInteractor.OnUIHoverExited(UIHoverEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
UIHoverEventArgs | args | Event data containing the UI element that is no longer hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.