Class ARGestureInteractor
The ARGestureInteractor allows the user to manipulate virtual objects (select, translate, rotate, scale, and elevate) through gestures (tap, drag, twist, and pinch).
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.AR
Syntax
[AddComponentMenu("XR/AR Gesture Interactor", 22)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.2/api/UnityEngine.XR.Interaction.Toolkit.AR.ARGestureInteractor.html")]
public class ARGestureInteractor : XRBaseInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRInteractor
Remarks
To make use of this, add an ARGestureInteractor to your scene and an ARBaseGestureInteractable to any of your virtual objects.
Properties
arSessionOrigin
The ARSessionOrigin that this Interactor will use (such as to get the Camera or to transform from Session space). Will find one if null.
Declaration
[Obsolete("arSessionOrigin is marked for deprecation and will be removed in a future version. Please use xrOrigin instead.")]
public ARSessionOrigin arSessionOrigin { get; set; }
Property Value
| Type | Description |
|---|---|
| ARSessionOrigin |
dragGestureRecognizer
(Read Only) The Drag gesture recognizer.
Declaration
public DragGestureRecognizer dragGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| DragGestureRecognizer |
DragGestureRecognizer
(Read Only) The Drag gesture recognizer.
Declaration
[Obsolete("DragGestureRecognizer has been deprecated. Use dragGestureRecognizer instead. (UnityUpgradable) -> dragGestureRecognizer")]
public DragGestureRecognizer DragGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| DragGestureRecognizer |
Remarks
DragGestureRecognizer has been deprecated. Use dragGestureRecognizer instead.
instance
(Read Only) The ARGestureInteractor instance.
Declaration
[Obsolete("instance has been deprecated. Use ARBaseGestureInteractable.gestureInteractor instead of singleton.")]
public static ARGestureInteractor instance { get; }
Property Value
| Type | Description |
|---|---|
| ARGestureInteractor |
Remarks
instance has been deprecated. Use gestureInteractor instead of singleton.
Instance
(Read Only) The ARGestureInteractor instance.
Declaration
[Obsolete("Instance has been deprecated. Use instance instead. (UnityUpgradable) -> instance")]
public static ARGestureInteractor Instance { get; }
Property Value
| Type | Description |
|---|---|
| ARGestureInteractor |
Remarks
Instance has been deprecated. Use instance instead.
pinchGestureRecognizer
(Read Only) The Pinch gesture recognizer.
Declaration
public PinchGestureRecognizer pinchGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| PinchGestureRecognizer |
PinchGestureRecognizer
(Read Only) The Pinch gesture recognizer.
Declaration
[Obsolete("PinchGestureRecognizer has been deprecated. Use pinchGestureRecognizer instead. (UnityUpgradable) -> pinchGestureRecognizer")]
public PinchGestureRecognizer PinchGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| PinchGestureRecognizer |
Remarks
PinchGestureRecognizer has been deprecated. Use pinchGestureRecognizer instead.
tapGestureRecognizer
(Read Only) The Tap gesture recognizer.
Declaration
public TapGestureRecognizer tapGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TapGestureRecognizer |
TapGestureRecognizer
(Read Only) The Tap gesture recognizer.
Declaration
[Obsolete("TapGestureRecognizer has been deprecated. Use tapGestureRecognizer instead. (UnityUpgradable) -> tapGestureRecognizer")]
public TapGestureRecognizer TapGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TapGestureRecognizer |
Remarks
TapGestureRecognizer has been deprecated. Use tapGestureRecognizer instead.
twistGestureRecognizer
(Read Only) The Twist gesture recognizer.
Declaration
public TwistGestureRecognizer twistGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TwistGestureRecognizer |
TwistGestureRecognizer
(Read Only) The Twist gesture recognizer.
Declaration
[Obsolete("TwistGestureRecognizer has been deprecated. Use twistGestureRecognizer instead. (UnityUpgradable) -> twistGestureRecognizer")]
public TwistGestureRecognizer TwistGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TwistGestureRecognizer |
Remarks
TwistGestureRecognizer has been deprecated. Use twistGestureRecognizer instead.
twoFingerDragGestureRecognizer
(Read Only) The two-finger Drag gesture recognizer.
Declaration
public TwoFingerDragGestureRecognizer twoFingerDragGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TwoFingerDragGestureRecognizer |
TwoFingerDragGestureRecognizer
(Read Only) The two-finger Drag gesture recognizer.
Declaration
[Obsolete("TwoFingerDragGestureRecognizer has been deprecated. Use twoFingerDragGestureRecognizer instead. (UnityUpgradable) -> twoFingerDragGestureRecognizer")]
public TwoFingerDragGestureRecognizer TwoFingerDragGestureRecognizer { get; }
Property Value
| Type | Description |
|---|---|
| TwoFingerDragGestureRecognizer |
Remarks
TwoFingerDragGestureRecognizer has been deprecated. Use twoFingerDragGestureRecognizer instead.
xrOrigin
The XROrigin that this Interactor will use (such as to get the Camera or to transform from Session space). Will find one if null.
Declaration
public XROrigin xrOrigin { get; set; }
Property Value
| Type | Description |
|---|---|
| XROrigin |
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
GetValidTargets(List<IXRInteractable>)
Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).
Declaration
public override void GetValidTargets(List<IXRInteractable> validTargets)
Parameters
| Type | Name | Description |
|---|---|---|
| List<IXRInteractable> | validTargets |
Overrides
Remarks
When implementing this method, Unity expects you to clear targets before adding to it.
OnDisable()
See MonoBehaviour.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
See MonoBehaviour.
Declaration
protected override void OnEnable()
Overrides
OnRegistered(InteractorRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is registered with it.
Declaration
protected override void OnRegistered(InteractorRegisteredEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| InteractorRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactor. |
Overrides
Remarks
args is only valid during this method call, do not hold a reference to it.
See Also
OnUnregistered(InteractorUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is unregistered from it.
Declaration
protected override void OnUnregistered(InteractorUnregisteredEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| InteractorUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactor. |
Overrides
Remarks
args is only valid during this method call, do not hold a reference to it.
See Also
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactor after interaction events occur.
Declaration
public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
| Type | Name | Description |
|---|---|---|
| XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Overrides
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
PushARSessionOrigin()
Passes the arSessionOrigin to the Gesture Recognizers.
Declaration
[Obsolete("PushARSessionOrigin has been deprecated. Use PushXROrigin instead for similar functionality.")]
protected virtual void PushARSessionOrigin()
See Also
PushXROrigin()
Passes the xrOrigin to the Gesture Recognizers.
Declaration
protected virtual void PushXROrigin()
See Also
Reset()
See MonoBehaviour.
Declaration
protected override void Reset()
Overrides
UpdateGestureRecognizers()
Update all Gesture Recognizers.
Declaration
protected virtual void UpdateGestureRecognizers()