Class XRBaseInteractable
Abstract base class from which all interactable behaviors derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover, selection, and focus.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: solution.dll
Syntax
[SelectionBase]
[DefaultExecutionOrder(-98)]
public abstract class XRBaseInteractable : MonoBehaviour, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect
Properties
| Name | Description |
|---|---|
| activated | The event that is called when the selecting Interactor activates this Interactable. |
| allowGazeAssistance | Enables gaze assistance with this interactable. |
| allowGazeInteraction | Enables interaction with XRGazeInteractor. |
| allowGazeSelect | Enables XRGazeInteractor to select this XRBaseInteractable. |
| canFocus | Indicates whether this Interactable can be focused. |
| colliders | (Read Only) Colliders to use for interaction with this Interactable (if empty, will use any child Colliders). |
| customReticle | The reticle that appears at the end of the line when valid. |
| deactivated | The event that is called when an Interactor deactivates this Interactable. |
| distanceCalculationMode | Specifies how this Interactable calculates its distance to a location, either using its Transform position, Collider position or Collider volume. |
| firstFocusEntered | The event that is called only when the first Interaction Group gains focus on this Interactable as the sole focusing Interactor. Subsequent Interactors that gain focus will not cause this event to be invoked as long as any others are still focusing. |
| firstHoverEntered | The event that is called only when the first Interactor begins hovering over this Interactable as the sole hovering Interactor. Subsequent Interactors that begin hovering over this Interactable will not cause this event to be invoked as long as any others are still hovering. |
| firstInteractionGroupFocusing | (Read Only) The first interaction group that is focused on this interactable since not being focused. The group may not currently be focusing this interactable, which would be the case when it released while multiple groups were focusing this interactable. |
| firstInteractorSelecting | (Read Only) The first interactor that selected this interactable since not being selected by any interactor. The interactor may not currently be selecting this interactable, which would be the case when it released while multiple interactors were selecting this interactable. |
| firstSelectEntered | The event that is called only when the first Interactor begins selecting this Interactable as the sole selecting Interactor. Subsequent Interactors that begin selecting this Interactable will not cause this event to be invoked as long as any others are still selecting. |
| focusEntered | The event that is called when an Interaction group gains focus on this Interactable. |
| focusExited | The event that is called when an Interaction group loses focus on this Interactable. |
| focusMode | Indicates the focus policy of an Interactable. |
| gazeTimeToSelect | Number of seconds for which an XRGazeInteractor must hover over this interactable to select it if hoverToSelect is enabled. |
| getDistanceOverride | Overriding callback of this object's distance calculation.
Use this to change the calculation performed in GetDistance(Vector3) without needing to create a derived class.
|
| hoverEntered | The event that is called when an Interactor begins hovering over this Interactable. |
| hoverExited | The event that is called when an Interactor ends hovering over this Interactable. |
| hoverFilters | The list of hover filters in this object. Used as additional hover validations for this Interactable. |
| interactionGroupsFocusing | (Read Only) The list of Interaction groups currently focusing on this Interactable (may by empty). |
| interactionLayers | Allows interaction with Interactors whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask. |
| interactionManager | The XRInteractionManager that this Interactable will communicate with (will find one if null). |
| interactionStrengthFilters | The list of interaction strength filters in this object. Used to modify the default interaction strength of an Interactor relative to this Interactable. This is useful for interactables that can be poked to report the depth of the poke interactor as a percentage while the poke interactor is hovering over this object. |
| interactorsHovering | (Read Only) The list of Interactors that are hovering on this Interactable (may by empty). |
| interactorsSelecting | (Read Only) The list of Interactors currently selecting this Interactable (may by empty). |
| isFocused | (Read Only) Indicates whether this interactable is currently being focused by any interaction group. |
| isHovered | (Read Only) Indicates whether an Interactor currently hovers over this Interactable. |
| isSelected | (Read Only) Indicates whether this interactable is currently being selected by any interactor. |
| largestInteractionStrength | The largest interaction strength value of all interactors hovering or selecting this interactable. |
| lastFocusExited | The event that is called only when the last remaining focused Interaction group loses focus on this Interactable. |
| lastHoverExited | The event that is called only when the last remaining hovering Interactor ends hovering over this Interactable. |
| lastSelectExited | The event that is called only when the last remaining selecting Interactor ends selecting this Interactable. |
| overrideGazeTimeToSelect | Enables this interactable to override the hoverTimeToSelect on a XRGazeInteractor. |
| overrideTimeToAutoDeselectGaze | Enables this interactable to override the timeToAutoDeselect on a XRGazeInteractor. |
| selectEntered | The event that is called when an Interactor begins selecting this Interactable. |
| selectExited | The event that is called when an Interactor ends selecting this Interactable. |
| selectFilters | The list of select filters in this object. Used as additional select validations for this Interactable. |
| selectMode | Indicates the selection policy of an Interactable. |
| startingHoverFilters | The hover filters that this object uses to automatically populate the hoverFilters List at startup (optional, may be empty). All objects in this list should implement the IXRHoverFilter interface. |
| startingInteractionStrengthFilters | The interaction strength filters that this object uses to automatically populate the interactionStrengthFilters List at startup (optional, may be empty). All objects in this list should implement the IXRInteractionStrengthFilter interface. |
| startingSelectFilters | The select filters that this object uses to automatically populate the selectFilters List at startup (optional, may be empty). All objects in this list should implement the IXRSelectFilter interface. |
| timeToAutoDeselectGaze | Number of seconds that the interactable will remain selected by a XRGazeInteractor before being automatically deselected if overrideTimeToAutoDeselectGaze is true. |
Methods
| Name | Description |
|---|---|
| AttachCustomReticle(IXRInteractor) | Attaches the custom reticle to the Interactor. |
| Awake() | See MonoBehaviour. |
| CaptureAttachPose(IXRSelectInteractor) | Capture the current Attach Transform pose. This method is automatically called by Unity to capture the pose during the moment of selection. |
| GetAttachPoseOnSelect(IXRSelectInteractor) | Gets the world position and rotation of the Attach Transform captured during the moment of selection. |
| GetAttachTransform(IXRInteractor) | Gets the Transform that serves as the attachment point for a given Interactor. |
| GetCustomReticle(IXRInteractor) | Looks for the current custom reticle that is attached based on a specific Interactor. |
| GetDistance(Vector3) | Gets the distance from this Interactable to the given location.
This method uses the calculation mode configured in distanceCalculationMode.
|
| GetDistanceSqrToInteractor(IXRInteractor) | Calculates squared distance to an Interactor (based on colliders). |
| GetInteractionStrength(IXRInteractor) | Gets the interaction strength between the given interactor and this interactable. |
| GetLocalAttachPoseOnSelect(IXRSelectInteractor) | Gets the local position and rotation of the Attach Transform captured during the moment of selection. |
| IsHoverableBy(IXRHoverInteractor) | Determines if a given Interactor can hover over this Interactable. |
| IsHovered(IXRHoverInteractor) | Determines whether this Interactable is currently being hovered by the Interactor. |
| IsHovered(IXRInteractor) | Determines whether this Interactable is currently being hovered by the Interactor. |
| IsSelectableBy(IXRSelectInteractor) | Determines if a given Interactor can select this Interactable. |
| IsSelected(IXRInteractor) | Determines whether this Interactable is currently being selected by the Interactor. |
| IsSelected(IXRSelectInteractor) | Determines whether this Interactable is currently being selected by the Interactor. |
| OnActivated(ActivateEventArgs) | XRBaseInputInteractor calls this method when the Interactor begins an activation event on this Interactable. |
| OnDeactivated(DeactivateEventArgs) | XRBaseInputInteractor calls this method when the Interactor ends an activation event on this Interactable. |
| OnDestroy() | See MonoBehaviour. |
| OnDisable() | See MonoBehaviour. |
| OnEnable() | See MonoBehaviour. |
| OnFocusEntered(FocusEnterEventArgs) | The XRInteractionManager calls this method when the Interaction group first gains focus of an Interactable in a second pass. |
| OnFocusEntering(FocusEnterEventArgs) | The XRInteractionManager calls this method right before the Interaction group first gains focus of an Interactable in a first pass. |
| OnFocusExited(FocusExitEventArgs) | The XRInteractionManager calls this method when the Interaction group loses focus of an Interactable in a second pass. |
| OnFocusExiting(FocusExitEventArgs) | The XRInteractionManager calls this method right before the Interaction group loses focus of an Interactable in a first pass. |
| OnHoverEntered(HoverEnterEventArgs) | The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass. |
| OnHoverEntering(HoverEnterEventArgs) | The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass. |
| OnHoverExited(HoverExitEventArgs) | The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass. |
| OnHoverExiting(HoverExitEventArgs) | The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass. |
| OnRegistered(InteractableRegisteredEventArgs) | The XRInteractionManager calls this method when this Interactable is registered with it. |
| OnSelectEntered(SelectEnterEventArgs) | The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass. |
| OnSelectEntering(SelectEnterEventArgs) | The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass. |
| OnSelectExited(SelectExitEventArgs) | The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass. |
| OnSelectExiting(SelectExitEventArgs) | The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass. |
| OnUnregistered(InteractableUnregisteredEventArgs) | The XRInteractionManager calls this method when this Interactable is unregistered from it. |
| ProcessHoverFilters(IXRHoverInteractor) | Returns the processing value of the filters in hoverFilters for the given Interactor and this Interactable. |
| ProcessInteractable(UpdatePhase) | The XRInteractionManager calls this method to update the Interactable. |
| ProcessInteractionStrength(UpdatePhase) | The XRInteractionManager calls this method to signal to update the interaction strength. |
| ProcessInteractionStrengthFilters(IXRInteractor, float) | Returns the processing value of the interaction strength filters in interactionStrengthFilters for the given Interactor and this Interactable. |
| ProcessSelectFilters(IXRSelectInteractor) | Returns the processing value of the filters in selectFilters for the given Interactor and this Interactable. |
| RemoveCustomReticle(IXRInteractor) | Removes the custom reticle from the Interactor. |
| Reset() | See MonoBehaviour. |
Events
| Name | Description |
|---|---|
| registered | Calls the methods in its invocation list when this Interactable is registered with an XRInteractionManager. |
| unregistered | Calls the methods in its invocation list when this Interactable is unregistered from an XRInteractionManager. |