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
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: solution.dll
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("XR/XR Direct Interactor", 11)]
[HelpURL("https://docs.unity.cn/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.XRDirectInteractor.html")]
public class XRDirectInteractor : XRBaseInputInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRActivateInteractor, IXRInteractor
Properties
| Name | Description |
|---|---|
| improveAccuracyWithSphereCollider | When a Sphere Collider component is the only collider on this interactor, and no Rigidbody component is attached, the interactor will use Burst compiler optimizations and sphere casts instead of relying on physics trigger events to evaluate direct interactions when this property is enabled. This also improves inter-frame accuracy and reliability. |
| physicsLayerMask | Physics layer mask used for limiting direct interactor overlaps when using the improveAccuracyWithSphereCollider option. |
| physicsTriggerInteraction | Determines whether the direct interactor sphere overlap will hit triggers when using the improveAccuracyWithSphereCollider option. |
| unsortedValidTargets | The set of Interactables that this Interactor could possibly interact with this frame. This list is not sorted by priority. |
| usingSphereColliderAccuracyImprovement | Whether the requirements were successfully met to use the alternate improved collider accuracy code path. |
Methods
| Name | Description |
|---|---|
| Awake() | See MonoBehaviour. |
| CanHover(IXRHoverInteractable) | Determines if the Interactable is valid for hover this frame. |
| CanSelect(IXRSelectInteractable) | Determines if the Interactable is valid for selection this frame. |
| 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). |
| OnDisable() | See MonoBehaviour. |
| OnEnable() | See MonoBehaviour. |
| OnRegistered(InteractorRegisteredEventArgs) | The XRInteractionManager calls this method when this Interactor is registered with it. |
| OnTriggerEnter(Collider) | See MonoBehaviour. |
| OnTriggerExit(Collider) | See MonoBehaviour. |
| OnTriggerStay(Collider) | See MonoBehaviour. |
| OnUnregistered(InteractorUnregisteredEventArgs) | The XRInteractionManager calls this method when this Interactor is unregistered from it. |
| 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. |
| ProcessInteractor(UpdatePhase) | The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor after interaction events occur. |