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).
Inherited Members
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
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
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
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
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
ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
Declaration
public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase |