Class XRGrabInteractable | XR Interaction Toolkit | 0.10.0-preview.7
docs.unity3d.com
    Show / Hide Table of Contents

    Class XRGrabInteractable

    Interactable component that allows basic "grab" functionality. Can attach to selecting interactor and follow it around while obeying physics (and inherit velocity when released).

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractable
    XRGrabInteractable
    Inherited Members
    XRBaseInteractable.interactionManager
    XRBaseInteractable.colliders
    XRBaseInteractable.interactionLayerMask
    XRBaseInteractable.hoveringInteractors
    XRBaseInteractable.isHovered
    XRBaseInteractable.isSelected
    XRBaseInteractable.onFirstHoverEntered
    XRBaseInteractable.onFirstHoverEnter
    XRBaseInteractable.onHoverEntered
    XRBaseInteractable.onHoverEnter
    XRBaseInteractable.onHoverExited
    XRBaseInteractable.onHoverExit
    XRBaseInteractable.onLastHoverExited
    XRBaseInteractable.onLastHoverExit
    XRBaseInteractable.onSelectEntered
    XRBaseInteractable.onSelectEnter
    XRBaseInteractable.onSelectExited
    XRBaseInteractable.onSelectExit
    XRBaseInteractable.onSelectCanceled
    XRBaseInteractable.onSelectCancel
    XRBaseInteractable.onActivate
    XRBaseInteractable.onDeactivate
    XRBaseInteractable.customReticle
    XRBaseInteractable.Reset()
    XRBaseInteractable.OnDestroy()
    XRBaseInteractable.GetDistanceSqrToInteractor(XRBaseInteractor)
    XRBaseInteractable.IsSelectableBy(XRBaseInteractor)
    XRBaseInteractable.OnHoverEntering(XRBaseInteractor)
    XRBaseInteractable.OnHoverEntered(XRBaseInteractor)
    XRBaseInteractable.OnHoverExiting(XRBaseInteractor)
    XRBaseInteractable.OnHoverExited(XRBaseInteractor)
    XRBaseInteractable.OnSelectExited(XRBaseInteractor)
    XRBaseInteractable.OnSelectCanceled(XRBaseInteractor)
    XRBaseInteractable.OnActivate(XRBaseInteractor)
    XRBaseInteractable.AttachCustomReticle(XRBaseInteractor)
    XRBaseInteractable.RemoveCustomReticle(XRBaseInteractor)
    XRBaseInteractable.OnDeactivate(XRBaseInteractor)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(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, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, 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
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    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, Boolean)
    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, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    [SelectionBase]
    [DisallowMultipleComponent]
    [RequireComponent(typeof(Rigidbody))]
    [AddComponentMenu("XR/XR Grab Interactable")]
    public class XRGrabInteractable : XRBaseInteractable

    Properties

    attachEaseInTime

    Time it takes to ease in the attach (a value of 0 indicates no easing).

    Declaration
    public float attachEaseInTime { get; set; }
    Property Value
    Type Description
    Single

    attachTransform

    The attachment point to use on this Interactable (will use transform.position as center if none set).

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

    gravityOnDetach

    Whether object has gravity when released.

    Declaration
    public bool gravityOnDetach { get; set; }
    Property Value
    Type Description
    Boolean

    movementType

    The movement type for the Rigidbody.

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

    retainTransformParent

    Whether to retain the transform's location in the scene hierarchy when the object is dropped.

    Declaration
    public bool retainTransformParent { get; set; }
    Property Value
    Type Description
    Boolean

    selectingInteractor

    (Read Only) The current selecting interactor for this interactable.

    Declaration
    public XRBaseInteractor selectingInteractor { get; }
    Property Value
    Type Description
    XRBaseInteractor

    smoothPosition

    Whether smoothing is applied to the position of the object.

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

    smoothPositionAmount

    The smoothing applied to the object's position when following.

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

    smoothRotation

    Apply smoothing to the follow rotation of the object.

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

    smoothRotationAmount

    The smoothing applied to the object's rotation when following.

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

    throwAngularVelocityScale

    The angular velocity scale used when throwing.

    Declaration
    public float throwAngularVelocityScale { get; set; }
    Property Value
    Type Description
    Single

    throwOnDetach

    Whether the object inherits the interactor's velocity when released.

    Declaration
    public bool throwOnDetach { get; set; }
    Property Value
    Type Description
    Boolean

    throwSmoothingCurve

    The curve to use to weight velocity smoothing (most recent frames to the right).

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

    throwSmoothingDuration

    The time period to average thrown velocity over.

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

    throwVelocityScale

    The velocity scale used when throwing.

    Declaration
    public float throwVelocityScale { get; set; }
    Property Value
    Type Description
    Single

    tightenPosition

    The maximum follow position difference when using smoothing.

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

    tightenRotation

    The maximum follow rotation difference when using smoothing.

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

    trackPosition

    Whether this interactable should track the position of the interactor.

    Declaration
    public bool trackPosition { get; set; }
    Property Value
    Type Description
    Boolean

    trackRotation

    Whether this interactable should track the rotation of the interactor.

    Declaration
    public bool trackRotation { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    Awake()

    Declaration
    protected override void Awake()
    Overrides
    XRBaseInteractable.Awake()

    Drop()

    Declaration
    protected void Drop()

    IsHoverableBy(XRBaseInteractor)

    Determines if this interactable can be hovered by a given interactor.

    Declaration
    public override bool IsHoverableBy(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor to check for a valid hover state with.

    Returns
    Type Description
    Boolean

    Returns true if hovering is valid this frame. Returns false if not.

    Overrides
    XRBaseInteractable.IsHoverableBy(XRBaseInteractor)

    OnSelectCanceling(XRBaseInteractor)

    This method is called by the interaction manager right before the interactor targeting this interactable is disabled or destroyed, or if the interactable is unregistered.

    Declaration
    protected override void OnSelectCanceling(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Overrides
    XRBaseInteractable.OnSelectCanceling(XRBaseInteractor)
    See Also
    OnSelectEntered(XRBaseInteractor)
    OnSelectExited(XRBaseInteractor)

    OnSelectEntered(XRBaseInteractor)

    This method is called by the interaction manager when the interactor first initiates selection of an interactable.

    Declaration
    protected override void OnSelectEntered(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the selection.

    Overrides
    XRBaseInteractable.OnSelectEntered(XRBaseInteractor)
    See Also
    OnSelectExited(XRBaseInteractor)
    OnSelectCanceled(XRBaseInteractor)

    OnSelectEntering(XRBaseInteractor)

    This method is called by the interaction manager right before the interactor first initiates selection of an interactable.

    Declaration
    protected override void OnSelectEntering(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the selection.

    Overrides
    XRBaseInteractable.OnSelectEntering(XRBaseInteractor)
    See Also
    OnSelectEntered(XRBaseInteractor)

    OnSelectExiting(XRBaseInteractor)

    This method is called by the interaction manager right before the interactor ends selection of an interactable.

    Declaration
    protected override void OnSelectExiting(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Overrides
    XRBaseInteractable.OnSelectExiting(XRBaseInteractor)
    See Also
    OnSelectExited(XRBaseInteractor)

    ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)

    This method is called by the interaction manager to update the interactable. Please see the interaction manager documentation for more details on update order.

    Declaration
    public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase
    Overrides
    XRBaseInteractable.ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023