docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractable
    BaseTeleportationInteractable
    ClimbInteractable
    XRGrabInteractable
    XRSimpleInteractable
    Implements
    IXRActivateInteractable
    IXRHoverInteractable
    IXRSelectInteractable
    IXRFocusInteractable
    IXRInteractionStrengthInteractable
    IXRInteractable
    IXROverridesGazeAutoSelect
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    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.
    When a callback is assigned to this property, the GetDistance(Vector3) execution calls it to perform the distance calculation instead of using its default calculation (specified by distanceCalculationMode in this base class). Assign null to this property to restore the default calculation.

    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.
    This method can be overridden (without needing to subclass) by assigning a callback to getDistanceOverride. To restore the previous calculation mode configuration, assign null to getDistanceOverride.

    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.

    Extension Methods

    XRFocusInteractableExtensions.GetOldestInteractorFocusing(IXRFocusInteractable)
    XRHoverInteractableExtensions.GetOldestInteractorHovering(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByLeft(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByRight(IXRHoverInteractable)
    XRSelectInteractableExtensions.GetOldestInteractorSelecting(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByLeft(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByRight(IXRSelectInteractable)
    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)