Class XRDirectInteractor
Interactor used for directly interacting with interactables that are touching. This is handled via trigger volumes that update the current set of valid targets for this interactor. This component must have a collision volume that is set to be a trigger to work.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("XR/XR Direct Interactor")]
public class XRDirectInteractor : XRBaseControllerInteractor
Properties
validTargets
(Read Only) A list of targets that can be selected.
Declaration
protected override List<XRBaseInteractable> validTargets { get; }
Property Value
Type | Description |
---|---|
List<XRBaseInteractable> |
Overrides
Methods
Awake()
Declaration
protected override void Awake()
Overrides
CanHover(XRBaseInteractable)
Determines if the interactable is valid for hover this frame.
Declaration
public override bool CanHover(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the interactable can be hovered over this frame. |
Overrides
CanSelect(XRBaseInteractable)
Determines if the interactable is valid for selection this frame.
Declaration
public override bool CanSelect(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the interactable can be selected this frame. |
Overrides
GetValidTargets(List<XRBaseInteractable>)
Retrieve the list of interactables that this interactor could possibly interact with this frame. This list is sorted by priority (in this case distance).
Declaration
public override void GetValidTargets(List<XRBaseInteractable> validTargets)
Parameters
Type | Name | Description |
---|---|---|
List<XRBaseInteractable> | validTargets | Populated List of interactables that are valid for selection or hover. |
Overrides
OnTriggerEnter(Collider)
Declaration
protected void OnTriggerEnter(Collider col)
Parameters
Type | Name | Description |
---|---|---|
Collider | col |
OnTriggerExit(Collider)
Declaration
protected void OnTriggerExit(Collider col)
Parameters
Type | Name | Description |
---|---|---|
Collider | col |