docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRGrabInteractable

    Interactable component that allows for basic grab functionality. When this behavior is selected (grabbed) by an Interactor, this behavior will follow it around and inherit velocity when released.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractable
    XRGrabInteractable
    Implements
    IXRActivateInteractable
    IXRHoverInteractable
    IXRSelectInteractable
    IXRFocusInteractable
    IXRInteractionStrengthInteractable
    IXRInteractable
    IXROverridesGazeAutoSelect
    IFarAttachProvider
    Inherited Members
    XRBaseInteractable.registered
    XRBaseInteractable.unregistered
    XRBaseInteractable.getDistanceOverride
    XRBaseInteractable.interactionManager
    XRBaseInteractable.colliders
    XRBaseInteractable.interactionLayers
    XRBaseInteractable.distanceCalculationMode
    XRBaseInteractable.selectMode
    XRBaseInteractable.focusMode
    XRBaseInteractable.customReticle
    XRBaseInteractable.allowGazeInteraction
    XRBaseInteractable.allowGazeSelect
    XRBaseInteractable.overrideGazeTimeToSelect
    XRBaseInteractable.gazeTimeToSelect
    XRBaseInteractable.overrideTimeToAutoDeselectGaze
    XRBaseInteractable.timeToAutoDeselectGaze
    XRBaseInteractable.allowGazeAssistance
    XRBaseInteractable.firstHoverEntered
    XRBaseInteractable.lastHoverExited
    XRBaseInteractable.hoverEntered
    XRBaseInteractable.hoverExited
    XRBaseInteractable.firstSelectEntered
    XRBaseInteractable.lastSelectExited
    XRBaseInteractable.selectEntered
    XRBaseInteractable.selectExited
    XRBaseInteractable.firstFocusEntered
    XRBaseInteractable.lastFocusExited
    XRBaseInteractable.focusEntered
    XRBaseInteractable.focusExited
    XRBaseInteractable.activated
    XRBaseInteractable.deactivated
    XRBaseInteractable.interactorsHovering
    XRBaseInteractable.isHovered
    XRBaseInteractable.interactorsSelecting
    XRBaseInteractable.firstInteractorSelecting
    XRBaseInteractable.isSelected
    XRBaseInteractable.interactionGroupsFocusing
    XRBaseInteractable.firstInteractionGroupFocusing
    XRBaseInteractable.isFocused
    XRBaseInteractable.canFocus
    XRBaseInteractable.startingHoverFilters
    XRBaseInteractable.hoverFilters
    XRBaseInteractable.startingSelectFilters
    XRBaseInteractable.selectFilters
    XRBaseInteractable.startingInteractionStrengthFilters
    XRBaseInteractable.interactionStrengthFilters
    XRBaseInteractable.largestInteractionStrength
    XRBaseInteractable.Reset()
    XRBaseInteractable.OnEnable()
    XRBaseInteractable.OnDisable()
    XRBaseInteractable.GetAttachPoseOnSelect(IXRSelectInteractor)
    XRBaseInteractable.GetLocalAttachPoseOnSelect(IXRSelectInteractor)
    XRBaseInteractable.GetDistanceSqrToInteractor(IXRInteractor)
    XRBaseInteractable.GetDistance(Vector3)
    XRBaseInteractable.GetInteractionStrength(IXRInteractor)
    XRBaseInteractable.IsHoverableBy(IXRHoverInteractor)
    XRBaseInteractable.IsSelectableBy(IXRSelectInteractor)
    XRBaseInteractable.IsHovered(IXRHoverInteractor)
    XRBaseInteractable.IsSelected(IXRSelectInteractor)
    XRBaseInteractable.IsHovered(IXRInteractor)
    XRBaseInteractable.IsSelected(IXRInteractor)
    XRBaseInteractable.GetCustomReticle(IXRInteractor)
    XRBaseInteractable.AttachCustomReticle(IXRInteractor)
    XRBaseInteractable.RemoveCustomReticle(IXRInteractor)
    XRBaseInteractable.CaptureAttachPose(IXRSelectInteractor)
    XRBaseInteractable.OnRegistered(InteractableRegisteredEventArgs)
    XRBaseInteractable.OnUnregistered(InteractableUnregisteredEventArgs)
    XRBaseInteractable.OnHoverEntering(HoverEnterEventArgs)
    XRBaseInteractable.OnHoverEntered(HoverEnterEventArgs)
    XRBaseInteractable.OnHoverExiting(HoverExitEventArgs)
    XRBaseInteractable.OnHoverExited(HoverExitEventArgs)
    XRBaseInteractable.OnSelectEntered(SelectEnterEventArgs)
    XRBaseInteractable.OnFocusEntering(FocusEnterEventArgs)
    XRBaseInteractable.OnFocusEntered(FocusEnterEventArgs)
    XRBaseInteractable.OnFocusExiting(FocusExitEventArgs)
    XRBaseInteractable.OnFocusExited(FocusExitEventArgs)
    XRBaseInteractable.OnActivated(ActivateEventArgs)
    XRBaseInteractable.OnDeactivated(DeactivateEventArgs)
    XRBaseInteractable.ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase)
    XRBaseInteractable.ProcessHoverFilters(IXRHoverInteractor)
    XRBaseInteractable.ProcessSelectFilters(IXRSelectInteractor)
    XRBaseInteractable.ProcessInteractionStrengthFilters(IXRInteractor, float)
    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.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactables
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    [SelectionBase]
    [DisallowMultipleComponent]
    [RequireComponent(typeof(Rigidbody))]
    [AddComponentMenu("XR/XR Grab Interactable", 11)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Interactables.XRGrabInteractable.html")]
    public class XRGrabInteractable : XRBaseInteractable, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect, IFarAttachProvider
    Remarks

    This behavior is responsible for applying the position, rotation, and local scale calculated by one or more IXRGrabTransformer implementations. A default set of grab transformers are automatically added by Unity, but this functionality can be disabled to manually set those used by this behavior, allowing you to customize where this component should move and rotate to.

    Grab transformers are classified into two different types: Single and Multiple. Those added to the Single Grab Transformers list are used when there is a single interactor selecting this object. Those added to the Multiple Grab Transformers list are used when there are multiple interactors selecting this object. You can add multiple grab transformers in a category and they will each be processed in sequence. The Multiple Grab Transformers are given first opportunity to process when there are multiple grabs, and the Single Grab Transformer processing will be skipped if a Multiple Grab Transformer can process in that case.

    There are fallback rules that could allow a Single Grab Transformer to be processed when there are multiple grabs, and for a Multiple Grab Transformer to be processed when there is a single grab (though a grab transformer will never be processed if its canProcess returns false).

    • When there is a single interactor selecting this object, the Multiple Grab Transformer will be processed only if the Single Grab Transformer list is empty or if all transformers in the Single Grab Transformer list return false during processing.
    • When there are multiple interactors selecting this object, the Single Grab Transformer will be processed only if the Multiple Grab Transformer list is empty or if all transformers in the Multiple Grab Transformer list return false during processing.

    Properties

    addDefaultGrabTransformers

    Whether Unity will add the default set of grab transformers if either the Single or Multiple Grab Transformers lists are empty.

    Declaration
    public bool addDefaultGrabTransformers { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Set this to false if you want to manually set the grab transformers used by populating startingSingleGrabTransformers and startingMultipleGrabTransformers.

    See Also
    AddDefaultSingleGrabTransformer()
    AddDefaultMultipleGrabTransformer()

    angularVelocityDamping

    Scale factor of how much Unity dampens the existing angular velocity when tracking the rotation of the Interactor. The smaller the value, the longer it takes for the angular velocity to decay.

    Declaration
    public float angularVelocityDamping { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Only applies when in VelocityTracking mode.

    See Also
    VelocityTracking
    trackRotation

    angularVelocityScale

    Scale factor Unity applies to the tracked angular velocity while updating the Rigidbody when tracking the rotation of the Interactor.

    Declaration
    public float angularVelocityScale { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Only applies when in VelocityTracking mode.

    See Also
    VelocityTracking
    trackRotation

    attachEaseInTime

    Time in seconds Unity eases in the attach when selected (a value of 0 indicates no easing).

    Declaration
    public float attachEaseInTime { get; set; }
    Property Value
    Type Description
    float
    See Also
    IXRGrabTransformer

    attachTransform

    The attachment point Unity uses on this Interactable (will use this object's position if none set).

    Declaration
    public Transform attachTransform { get; set; }
    Property Value
    Type Description
    Transform
    See Also
    IXRGrabTransformer

    farAttachMode

    When selected because of a far interaction caster, controls how the interactor should attach to the interactable. Specifically, it controls whether the interactor's attach transform should move to the far hit point or whether it should stay near so the object can move to the hand.

    Declaration
    public InteractableFarAttachMode farAttachMode { get; set; }
    Property Value
    Type Description
    InteractableFarAttachMode
    See Also
    IXRGrabTransformer

    forceGravityOnDetach

    Forces this object to have gravity when released (will still use pre-grab value if this is false).

    Declaration
    public bool forceGravityOnDetach { get; set; }
    Property Value
    Type Description
    bool
    See Also
    IXRGrabTransformer

    matchAttachPosition

    Match the position of the Interactor's attachment point when initializing the grab. This will override the position of attachTransform.

    Declaration
    public bool matchAttachPosition { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This will initialize the dynamic attachment point of this object using the position of the Interactor's attachment point. This value can be overridden for a specific interactor by overriding ShouldMatchAttachPosition(IXRSelectInteractor).

    See Also
    useDynamicAttach
    matchAttachRotation

    matchAttachRotation

    Match the rotation of the Interactor's attachment point when initializing the grab. This will override the rotation of attachTransform.

    Declaration
    public bool matchAttachRotation { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This will initialize the dynamic attachment point of this object using the rotation of the Interactor's attachment point. This value can be overridden for a specific interactor by overriding ShouldMatchAttachRotation(IXRSelectInteractor).

    See Also
    useDynamicAttach
    matchAttachPosition

    movementType

    Specifies how this object moves when selected, either through setting the velocity of the Rigidbody, moving the kinematic Rigidbody during Fixed Update, or by directly updating the Transform each frame.

    Declaration
    public XRBaseInteractable.MovementType movementType { get; set; }
    Property Value
    Type Description
    XRBaseInteractable.MovementType
    See Also
    XRBaseInteractable.MovementType

    multipleGrabTransformersCount

    The number of multiple grab transformers. These are the grab transformers used when there are multiple interactors selecting this object.

    Declaration
    public int multipleGrabTransformersCount { get; }
    Property Value
    Type Description
    int
    See Also
    AddMultipleGrabTransformer(IXRGrabTransformer)

    reinitializeDynamicAttachEverySingleGrab

    Re-initialize the dynamic attachment pose when changing from multiple grabs back to a single grab. Use this if you want to keep the current pose of the object after releasing a second hand rather than reverting back to the attach pose from the original grab.

    Declaration
    public bool reinitializeDynamicAttachEverySingleGrab { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    selectMode must be set to Multiple for this setting to take effect.

    See Also
    useDynamicAttach
    selectMode

    retainTransformParent

    Whether Unity sets the parent of this object back to its original parent this object was a child of after this object is dropped.

    Declaration
    public bool retainTransformParent { get; set; }
    Property Value
    Type Description
    bool
    See Also
    IXRGrabTransformer

    secondaryAttachTransform

    The secondary attachment point to use on this Interactable for multi-hand interaction (will use the second interactor's attach transform if none set). Used for multi-grab interactions.

    Declaration
    public Transform secondaryAttachTransform { get; set; }
    Property Value
    Type Description
    Transform
    See Also
    IXRGrabTransformer

    singleGrabTransformersCount

    The number of single grab transformers. These are the grab transformers used when there is a single interactor selecting this object.

    Declaration
    public int singleGrabTransformersCount { get; }
    Property Value
    Type Description
    int
    See Also
    AddSingleGrabTransformer(IXRGrabTransformer)

    smoothPosition

    Whether Unity applies smoothing while following the position of the Interactor when selected.

    Declaration
    public bool smoothPosition { get; set; }
    Property Value
    Type Description
    bool
    See Also
    smoothPositionAmount
    tightenPosition

    smoothPositionAmount

    Scale factor for how much smoothing is applied while following the position of the Interactor when selected. The larger the value, the closer this object will remain to the position of the Interactor.

    Declaration
    public float smoothPositionAmount { get; set; }
    Property Value
    Type Description
    float
    See Also
    smoothPosition
    tightenPosition

    smoothRotation

    Apply smoothing while following the rotation of the Interactor when selected.

    Declaration
    public bool smoothRotation { get; set; }
    Property Value
    Type Description
    bool
    See Also
    smoothRotationAmount
    tightenRotation

    smoothRotationAmount

    Scale factor for how much smoothing is applied while following the rotation of the Interactor when selected. The larger the value, the closer this object will remain to the rotation of the Interactor.

    Declaration
    public float smoothRotationAmount { get; set; }
    Property Value
    Type Description
    float
    See Also
    smoothRotation
    tightenRotation

    smoothScale

    Whether Unity applies smoothing while following the scale of the Interactor when selected.

    Declaration
    public bool smoothScale { get; set; }
    Property Value
    Type Description
    bool
    See Also
    smoothScaleAmount
    tightenScale

    smoothScaleAmount

    Scale factor for how much smoothing is applied while following the scale of the Interactor when selected. The larger the value, the closer this object will remain to the scale of the Interactor.

    Declaration
    public float smoothScaleAmount { get; set; }
    Property Value
    Type Description
    float
    See Also
    smoothScale
    tightenScale

    snapToColliderVolume

    Adjust the dynamic attachment point to keep it on or inside the Colliders that make up this object.

    Declaration
    public bool snapToColliderVolume { get; set; }
    Property Value
    Type Description
    bool
    See Also
    useDynamicAttach
    ShouldSnapToColliderVolume(IXRSelectInteractor)
    ClosestPoint(Vector3)

    startingMultipleGrabTransformers

    The grab transformers that this Interactable automatically links at startup (optional, may be empty). These are used when there are multiple interactors selecting this object.

    Declaration
    public List<XRBaseGrabTransformer> startingMultipleGrabTransformers { get; set; }
    Property Value
    Type Description
    List<XRBaseGrabTransformer>
    Remarks

    To modify the grab transformers used after startup, the AddMultipleGrabTransformer(IXRGrabTransformer) or RemoveMultipleGrabTransformer(IXRGrabTransformer) methods should be used instead.

    See Also
    startingSingleGrabTransformers

    startingSingleGrabTransformers

    The grab transformers that this Interactable automatically links at startup (optional, may be empty). These are used when there is a single interactor selecting this object.

    Declaration
    public List<XRBaseGrabTransformer> startingSingleGrabTransformers { get; set; }
    Property Value
    Type Description
    List<XRBaseGrabTransformer>
    Remarks

    To modify the grab transformers used after startup, the AddSingleGrabTransformer(IXRGrabTransformer) or RemoveSingleGrabTransformer(IXRGrabTransformer) methods should be used instead.

    See Also
    startingMultipleGrabTransformers

    throwAngularVelocityScale

    Scale factor Unity applies to this object's angular velocity inherited from the Interactor when released.

    Declaration
    public float throwAngularVelocityScale { get; set; }
    Property Value
    Type Description
    float
    See Also
    throwOnDetach

    throwOnDetach

    Whether this object inherits the velocity of the Interactor when released.

    Declaration
    public bool throwOnDetach { get; set; }
    Property Value
    Type Description
    bool
    See Also
    IXRGrabTransformer

    throwSmoothingCurve

    The curve used to weight velocity smoothing upon throwing (most recent frames to the right).

    Declaration
    public AnimationCurve throwSmoothingCurve { get; set; }
    Property Value
    Type Description
    AnimationCurve
    Remarks

    By default this curve is flat with a 1.0 value so all smoothing values are treated equally across the smoothing duration.

    See Also
    throwSmoothingDuration
    throwOnDetach

    throwSmoothingDuration

    This value represents the time over which collected samples are used for velocity calculation (up to a max of 20 previous frames, which is dependent on both Smoothing Duration and framerate).

    Declaration
    public float throwSmoothingDuration { get; set; }
    Property Value
    Type Description
    float
    Remarks

    As an example, if this value is set to 0.25, position and velocity values will be averaged over the past 0.25 seconds. Each of those values is weighted (multiplied) by the throwSmoothingCurve as well.

    See Also
    throwSmoothingCurve
    throwOnDetach

    throwVelocityScale

    Scale factor Unity applies to this object's linear velocity inherited from the Interactor when released.

    Declaration
    public float throwVelocityScale { get; set; }
    Property Value
    Type Description
    float
    See Also
    throwOnDetach

    tightenPosition

    Reduces the maximum follow position difference when using smoothing.

    Declaration
    public float tightenPosition { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Fractional amount of how close the smoothed position should remain to the position of the Interactor when using smoothing. The value ranges from 0 meaning no bias in the smoothed follow distance, to 1 meaning effectively no smoothing at all.

    See Also
    smoothPosition
    smoothPositionAmount

    tightenRotation

    Reduces the maximum follow rotation difference when using smoothing.

    Declaration
    public float tightenRotation { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Fractional amount of how close the smoothed rotation should remain to the rotation of the Interactor when using smoothing. The value ranges from 0 meaning no bias in the smoothed follow rotation, to 1 meaning effectively no smoothing at all.

    See Also
    smoothRotation
    smoothRotationAmount

    tightenScale

    Reduces the maximum follow scale difference when using smoothing.

    Declaration
    public float tightenScale { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Scale factor for how much smoothing is applied while following the scale of the determined by the transformer when selected. The larger the value, the closer this object will remain to the target scale determined by the interactable's transformer. The value ranges from 0 meaning no bias in the smoothed follow distance, to 1 meaning effectively no smoothing at all.

    See Also
    smoothScale
    smoothScaleAmount

    trackPosition

    Whether this object should follow the position of the Interactor when selected.

    Declaration
    public bool trackPosition { get; set; }
    Property Value
    Type Description
    bool
    See Also
    trackRotation
    trackScale

    trackRotation

    Whether this object should follow the rotation of the Interactor when selected.

    Declaration
    public bool trackRotation { get; set; }
    Property Value
    Type Description
    bool
    See Also
    trackPosition
    trackScale

    trackScale

    Whether or not the interactor will affect the scale of the object when selected.

    Declaration
    public bool trackScale { get; set; }
    Property Value
    Type Description
    bool
    See Also
    trackPosition
    trackRotation

    useDynamicAttach

    The grab pose will be based on the pose of the Interactor when the selection is made. Unity will create a dynamic attachment point for each Interactor that selects this component.

    Declaration
    public bool useDynamicAttach { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    A child GameObject will be created for each Interactor that selects this component to serve as the attachment point. These are cached and part of a shared pool used by all instances of XRGrabInteractable. Therefore, while a reference can be obtained by calling GetAttachTransform(IXRInteractor) while selected, you should typically not add any components to that GameObject unless you remove them after being released since it won't always be used by the same Interactable.

    See Also
    attachTransform
    InitializeDynamicAttachPose(IXRSelectInteractor, Transform)

    velocityDamping

    Scale factor of how much to dampen the existing linear velocity when tracking the position of the Interactor. The smaller the value, the longer it takes for the velocity to decay.

    Declaration
    public float velocityDamping { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Only applies when in VelocityTracking mode.

    See Also
    VelocityTracking
    trackPosition

    velocityScale

    Scale factor Unity applies to the tracked linear velocity while updating the Rigidbody when tracking the position of the Interactor.

    Declaration
    public float velocityScale { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Only applies when in VelocityTracking mode.

    See Also
    VelocityTracking
    trackPosition

    Methods

    AddDefaultMultipleGrabTransformer()

    Adds the default grab transformer (if the Multiple Grab Transformers list is empty) to the list of transformers used when there are multiple interactors selecting this object.

    Declaration
    protected virtual void AddDefaultMultipleGrabTransformer()
    See Also
    addDefaultGrabTransformers

    AddDefaultSingleGrabTransformer()

    Adds the default XRGeneralGrabTransformer (if the Single or Multiple Grab Transformers lists are empty) to the list of transformers used when there is a single interactor selecting this object.

    Declaration
    protected virtual void AddDefaultSingleGrabTransformer()
    See Also
    addDefaultGrabTransformers

    AddMultipleGrabTransformer(IXRGrabTransformer)

    Adds the given grab transformer to the list of transformers used when there are multiple interactors selecting this object.

    Declaration
    public void AddMultipleGrabTransformer(IXRGrabTransformer transformer)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to add.

    See Also
    AddSingleGrabTransformer(IXRGrabTransformer)

    AddSingleGrabTransformer(IXRGrabTransformer)

    Adds the given grab transformer to the list of transformers used when there is a single interactor selecting this object.

    Declaration
    public void AddSingleGrabTransformer(IXRGrabTransformer transformer)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to add.

    See Also
    AddMultipleGrabTransformer(IXRGrabTransformer)

    Awake()

    See MonoBehaviour.

    Declaration
    protected override void Awake()
    Overrides
    XRBaseInteractable.Awake()
    See Also
    IXRGrabTransformer

    ClearMultipleGrabTransformers()

    Removes all grab transformers from the list of transformers used when there is are multiple interactors selecting this object.

    Declaration
    public void ClearMultipleGrabTransformers()
    See Also
    ClearSingleGrabTransformers()

    ClearSingleGrabTransformers()

    Removes all grab transformers from the list of transformers used when there is a single interactor selecting this object.

    Declaration
    public void ClearSingleGrabTransformers()
    See Also
    ClearMultipleGrabTransformers()

    Detach()

    Updates the state of the object to finish the detach after being dropped. Automatically called during the end of the frame after being dropped.

    Declaration
    protected virtual void Detach()
    Remarks

    This method updates the velocity of the Rigidbody if configured to do so.

    See Also
    Drop()

    Drop()

    Updates the state of the object due to being dropped and schedule to finish the detach during the end of the frame. Automatically called when exiting the Select state.

    Declaration
    protected virtual void Drop()
    See Also
    Detach()
    Grab()

    GetAttachTransform(IXRInteractor)

    Gets the Transform that serves as the attachment point for a given Interactor.

    Declaration
    public override Transform GetAttachTransform(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The specific Interactor as context to get the attachment point for.

    Returns
    Type Description
    Transform

    Returns the attachment point Transform.

    Overrides
    XRBaseInteractable.GetAttachTransform(IXRInteractor)
    Remarks

    This should typically return the Transform of a child GameObject or the transform itself.

    See Also
    GetAttachTransform(IXRInteractable)

    GetMultipleGrabTransformerAt(int)

    Returns the grab transformer at index in the list of transformers used when there are multiple interactors selecting this object.

    Declaration
    public IXRGrabTransformer GetMultipleGrabTransformerAt(int index)
    Parameters
    Type Name Description
    int index

    Index of the grab transformer to return. Must be smaller than multipleGrabTransformersCount and not negative.

    Returns
    Type Description
    IXRGrabTransformer

    Returns the grab transformer at the given index.

    See Also
    GetSingleGrabTransformerAt(int)

    GetMultipleGrabTransformers(List<IXRGrabTransformer>)

    Returns all transformers used when there are multiple interactors selecting this object into List results.

    Declaration
    public void GetMultipleGrabTransformers(List<IXRGrabTransformer> results)
    Parameters
    Type Name Description
    List<IXRGrabTransformer> results

    List to receive grab transformers.

    Remarks

    This method populates the list with the grab transformers at the time the method is called. It is not a live view, meaning grab transformers added or removed afterward will not be reflected in the results of this method. Clears results before adding to it.

    See Also
    GetSingleGrabTransformers(List<IXRGrabTransformer>)

    GetSingleGrabTransformerAt(int)

    Returns the grab transformer at index in the list of transformers used when there is a single interactor selecting this object.

    Declaration
    public IXRGrabTransformer GetSingleGrabTransformerAt(int index)
    Parameters
    Type Name Description
    int index

    Index of the grab transformer to return. Must be smaller than singleGrabTransformersCount and not negative.

    Returns
    Type Description
    IXRGrabTransformer

    Returns the grab transformer at the given index.

    See Also
    GetMultipleGrabTransformerAt(int)

    GetSingleGrabTransformers(List<IXRGrabTransformer>)

    Returns all transformers used when there is a single interactor selecting this object into List results.

    Declaration
    public void GetSingleGrabTransformers(List<IXRGrabTransformer> results)
    Parameters
    Type Name Description
    List<IXRGrabTransformer> results

    List to receive grab transformers.

    Remarks

    This method populates the list with the grab transformers at the time the method is called. It is not a live view, meaning grab transformers added or removed afterward will not be reflected in the results of this method. Clears results before adding to it.

    See Also
    GetMultipleGrabTransformers(List<IXRGrabTransformer>)

    GetTargetLocalScale()

    Retrieves the current target local scale.

    Declaration
    public Vector3 GetTargetLocalScale()
    Returns
    Type Description
    Vector3

    Returns the current target local scale in the form of a Vector3 struct.

    See Also
    SetTargetLocalScale(Vector3)
    GetTargetPose()

    GetTargetPose()

    Retrieves the current world space target pose.

    Declaration
    public Pose GetTargetPose()
    Returns
    Type Description
    Pose

    Returns the current world space target pose in the form of a Pose struct.

    See Also
    SetTargetPose(Pose)
    GetTargetLocalScale()

    Grab()

    Updates the state of the object due to being grabbed. Automatically called when entering the Select state.

    Declaration
    protected virtual void Grab()
    See Also
    Drop()

    InitializeDynamicAttachPose(IXRSelectInteractor, Transform)

    Unity calls this method automatically when the interactor first initiates selection of this interactable. Override this method to set the pose of the dynamic attachment point. Before this method is called, the transform is already set as a child GameObject with inherited Transform values.

    Declaration
    protected virtual void InitializeDynamicAttachPose(IXRSelectInteractor interactor, Transform dynamicAttachTransform)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The interactor that is initiating the selection.

    Transform dynamicAttachTransform

    The dynamic attachment Transform that serves as the attachment point for the given interactor.

    Remarks

    This method is only called when useDynamicAttach is enabled.

    See Also
    useDynamicAttach

    MoveMultipleGrabTransformerTo(IXRGrabTransformer, int)

    Moves the given grab transformer in the list of transformers used when there are multiple interactors selecting this object. If the grab transformer is not in the list, this can be used to insert the grab transformer at the specified index.

    Declaration
    public void MoveMultipleGrabTransformerTo(IXRGrabTransformer transformer, int newIndex)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to move or add.

    int newIndex

    New index of the grab transformer.

    See Also
    MoveSingleGrabTransformerTo(IXRGrabTransformer, int)

    MoveSingleGrabTransformerTo(IXRGrabTransformer, int)

    Moves the given grab transformer in the list of transformers used when there is a single interactor selecting this object. If the grab transformer is not in the list, this can be used to insert the grab transformer at the specified index.

    Declaration
    public void MoveSingleGrabTransformerTo(IXRGrabTransformer transformer, int newIndex)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to move or add.

    int newIndex

    New index of the grab transformer.

    See Also
    MoveMultipleGrabTransformerTo(IXRGrabTransformer, int)

    OnDestroy()

    See MonoBehaviour.

    Declaration
    protected override void OnDestroy()
    Overrides
    XRBaseInteractable.OnDestroy()
    See Also
    IXRGrabTransformer

    OnSelectEntering(SelectEnterEventArgs)

    The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectEntering(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactor that is initiating the selection.

    Overrides
    XRBaseInteractable.OnSelectEntering(SelectEnterEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    OnSelectExited(SelectExitEventArgs)

    The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.

    Declaration
    protected override void OnSelectExited(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactor that is ending the selection.

    Overrides
    XRBaseInteractable.OnSelectExited(SelectExitEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    OnSelectExiting(SelectExitEventArgs)

    The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectExiting(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactor that is ending the selection.

    Overrides
    XRBaseInteractable.OnSelectExiting(SelectExitEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectExited(SelectExitEventArgs)

    ProcessInteractable(UpdatePhase)

    The XRInteractionManager calls this method to update the Interactable.

    Declaration
    public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase this is called during.

    Overrides
    XRBaseInteractable.ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    Remarks

    Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.

    See Also
    XRInteractionUpdateOrder.UpdatePhase
    ProcessInteractor(UpdatePhase)

    RemoveMultipleGrabTransformer(IXRGrabTransformer)

    Removes the given grab transformer from the list of transformers used when there is are multiple interactors selecting this object.

    Declaration
    public bool RemoveMultipleGrabTransformer(IXRGrabTransformer transformer)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to remove.

    Returns
    Type Description
    bool

    Returns true if transformer was removed from the list. Otherwise, returns false if transformer was not found in the list.

    See Also
    RemoveSingleGrabTransformer(IXRGrabTransformer)

    RemoveSingleGrabTransformer(IXRGrabTransformer)

    Removes the given grab transformer from the list of transformers used when there is a single interactor selecting this object.

    Declaration
    public bool RemoveSingleGrabTransformer(IXRGrabTransformer transformer)
    Parameters
    Type Name Description
    IXRGrabTransformer transformer

    The grab transformer to remove.

    Returns
    Type Description
    bool

    Returns true if transformer was removed from the list. Otherwise, returns false if transformer was not found in the list.

    See Also
    RemoveMultipleGrabTransformer(IXRGrabTransformer)

    SetTargetLocalScale(Vector3)

    Sets a new target local scale.

    Declaration
    public void SetTargetLocalScale(Vector3 localScale)
    Parameters
    Type Name Description
    Vector3 localScale

    The new target local scale, represented as a Vector3 struct.

    Remarks

    This bypasses easing and smoothing.

    See Also
    GetTargetLocalScale()
    SetTargetPose(Pose)

    SetTargetPose(Pose)

    Sets a new world space target pose.

    Declaration
    public void SetTargetPose(Pose pose)
    Parameters
    Type Name Description
    Pose pose

    The new world space target pose, represented as a Pose struct.

    Remarks

    This bypasses easing and smoothing.

    See Also
    GetTargetPose()
    SetTargetLocalScale(Vector3)

    SetupRigidbodyDrop(Rigidbody)

    Setup the Rigidbody on this object due to being dropped. Automatically called when exiting the Select state.

    Declaration
    protected virtual void SetupRigidbodyDrop(Rigidbody rigidbody)
    Parameters
    Type Name Description
    Rigidbody rigidbody

    The Rigidbody on this object.

    See Also
    SetupRigidbodyGrab(Rigidbody)

    SetupRigidbodyGrab(Rigidbody)

    Setup the Rigidbody on this object due to being grabbed. Automatically called when entering the Select state.

    Declaration
    protected virtual void SetupRigidbodyGrab(Rigidbody rigidbody)
    Parameters
    Type Name Description
    Rigidbody rigidbody

    The Rigidbody on this object.

    See Also
    SetupRigidbodyDrop(Rigidbody)

    ShouldMatchAttachPosition(IXRSelectInteractor)

    Unity calls this method automatically when initializing the dynamic attach pose. Used to override matchAttachPosition for a specific interactor.

    Declaration
    protected virtual bool ShouldMatchAttachPosition(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The interactor that is initiating the selection.

    Returns
    Type Description
    bool

    Returns whether to match the position of the interactor's attachment point when initializing the grab.

    See Also
    matchAttachPosition
    InitializeDynamicAttachPose(IXRSelectInteractor, Transform)

    ShouldMatchAttachRotation(IXRSelectInteractor)

    Unity calls this method automatically when initializing the dynamic attach pose. Used to override matchAttachRotation for a specific interactor.

    Declaration
    protected virtual bool ShouldMatchAttachRotation(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The interactor that is initiating the selection.

    Returns
    Type Description
    bool

    Returns whether to match the rotation of the interactor's attachment point when initializing the grab.

    See Also
    matchAttachRotation
    InitializeDynamicAttachPose(IXRSelectInteractor, Transform)

    ShouldSnapToColliderVolume(IXRSelectInteractor)

    Unity calls this method automatically when initializing the dynamic attach pose. Used to override snapToColliderVolume for a specific interactor.

    Declaration
    protected virtual bool ShouldSnapToColliderVolume(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The interactor that is initiating the selection.

    Returns
    Type Description
    bool

    Returns whether to adjust the dynamic attachment point to keep it on or inside the Colliders that make up this object.

    See Also
    snapToColliderVolume
    InitializeDynamicAttachPose(IXRSelectInteractor, Transform)

    Implements

    IXRActivateInteractable
    IXRHoverInteractable
    IXRSelectInteractable
    IXRFocusInteractable
    IXRInteractionStrengthInteractable
    IXRInteractable
    IXROverridesGazeAutoSelect
    IFarAttachProvider

    Extension Methods

    XRFocusInteractableExtensions.GetOldestInteractorFocusing(IXRFocusInteractable)
    XRHoverInteractableExtensions.GetOldestInteractorHovering(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByLeft(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByRight(IXRHoverInteractable)
    XRSelectInteractableExtensions.GetOldestInteractorSelecting(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByLeft(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByRight(IXRSelectInteractable)

    See Also

    IXRGrabTransformer
    In This Article
    Back to top
    Copyright © 2025 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)