Class XRGrabInteractable | XR Interaction Toolkit | 0.0.6-preview
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
    XRBaseInteractable
    XRGrabInteractable
    Inherited Members
    XRBaseInteractable.interactionManager
    XRBaseInteractable.colliders
    XRBaseInteractable.interactionLayerMask
    XRBaseInteractable.hoveringInteractors
    XRBaseInteractable.isHovered
    XRBaseInteractable.isSelected
    XRBaseInteractable.cachedDistanceToInteractor
    XRBaseInteractable.onFirstHoverEnter
    XRBaseInteractable.onHoverEnter
    XRBaseInteractable.onHoverExit
    XRBaseInteractable.onLastHoverExit
    XRBaseInteractable.onSelectEnter
    XRBaseInteractable.onSelectExit
    XRBaseInteractable.onActivate
    XRBaseInteractable.onDeactivate
    XRBaseInteractable.Reset()
    XRBaseInteractable.GetDistanceSqrToInteractor(XRBaseInteractor)
    XRBaseInteractable.OnHoverEnter(XRBaseInteractor)
    XRBaseInteractable.OnHoverExit(XRBaseInteractor)
    XRBaseInteractable.OnActivate(XRBaseInteractor)
    XRBaseInteractable.customReticle
    XRBaseInteractable.AttachCustomReticle(XRBaseInteractor)
    XRBaseInteractable.RemoveCustomReticle(XRBaseInteractor)
    XRBaseInteractable.OnDeactivate(XRBaseInteractor)
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    public class XRGrabInteractable : XRBaseInteractable

    Properties

    attachEaseInTime

    Gets or sets Time it takes to ease in the attach (time of 0.0 indicates no easing).

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

    attachTransform

    Gets or sets attach point to use on this Interactable (will use RigidBody center if none set).

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

    gravityOnDetach

    Gets or sets whether object has gravity when released.

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

    movementType

    Gets or sets movement type for RigidBody.

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

    smoothPosition

    Gets or sets whether smoothing is applied to the position of the object.

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

    smoothPositionAmount

    Gets or sets the smoothing applied to the object's position when following.

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

    smoothRotation

    Gets or sets Apply smoothing to the follow rotation of the object.

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

    smoothRotationAmount

    Gets or sets the smoothing applied to the object's rotation when following.

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

    throwAngularVelocityScale

    Gets or set the the angular velocity scale used when throwing.

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

    throwOnDetach

    Gets or sets whether the object inherits the interactor's velocity when released.

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

    throwSmoothingDuration

    Gets or sets the time period to average thrown velocity over

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

    throwVelocityScale

    Gets or set the the velocity scale used when throwing.

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

    tightenPosition

    Gets or sets the maximum follow position difference when using smoothing.

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

    tightenRotation

    Gets or sets the maximum follow rotation difference when using smoothing.

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

    trackPosition

    Gets or sets whether this interactable should track the position of the interactor.

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

    trackRotation

    Gets or sets 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()

    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

    True if hovering is valid this frame, False if not.

    Overrides
    XRBaseInteractable.IsHoverableBy(XRBaseInteractor)

    IsSelectableBy(XRBaseInteractor)

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

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

    Interactor to check for a valid selection with.

    Returns
    Type Description
    Boolean

    True if selection is valid this frame, False if not.

    Overrides
    XRBaseInteractable.IsSelectableBy(XRBaseInteractor)

    OnSelectEnter(XRBaseInteractor)

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

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

    Interactor that is initiating the selection.

    Overrides
    XRBaseInteractable.OnSelectEnter(XRBaseInteractor)

    OnSelectExit(XRBaseInteractor)

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

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

    Interactor that is ending the selection.

    Overrides
    XRBaseInteractable.OnSelectExit(XRBaseInteractor)

    ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)

    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