Class ARGestureInteractor
The ARGestureInteractor allows the user to manipulate virtual objects (select, translate, rotate, scale, and elevate) through gestures (tap, drag, twist, and pinch).
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.AR
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/AR Gesture Interactor", 22)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.5/api/UnityEngine.XR.Interaction.Toolkit.AR.ARGestureInteractor.html")]
public class ARGestureInteractor : XRBaseInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRInteractor
Remarks
To make use of this, add an ARGestureInteractor to your scene and an ARBaseGestureInteractable to any of your virtual objects.
Properties
dragGestureRecognizer
(Read Only) The Drag gesture recognizer.
Declaration
public DragGestureRecognizer dragGestureRecognizer { get; }
Property Value
Type | Description |
---|---|
DragGestureRecognizer |
pinchGestureRecognizer
(Read Only) The Pinch gesture recognizer.
Declaration
public PinchGestureRecognizer pinchGestureRecognizer { get; }
Property Value
Type | Description |
---|---|
PinchGestureRecognizer |
raycastMask
Gets or sets layer mask used for limiting ray cast targets.
Declaration
public LayerMask raycastMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
raycastTriggerInteraction
Gets or sets type of interaction with trigger colliders via ray cast.
Declaration
public QueryTriggerInteraction raycastTriggerInteraction { get; set; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
tapGestureRecognizer
(Read Only) The Tap gesture recognizer.
Declaration
public TapGestureRecognizer tapGestureRecognizer { get; }
Property Value
Type | Description |
---|---|
TapGestureRecognizer |
twistGestureRecognizer
(Read Only) The Twist gesture recognizer.
Declaration
public TwistGestureRecognizer twistGestureRecognizer { get; }
Property Value
Type | Description |
---|---|
TwistGestureRecognizer |
twoFingerDragGestureRecognizer
(Read Only) The two-finger Drag gesture recognizer.
Declaration
public TwoFingerDragGestureRecognizer twoFingerDragGestureRecognizer { get; }
Property Value
Type | Description |
---|---|
TwoFingerDragGestureRecognizer |
xrOrigin
The Unity.XR.CoreUtils.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(UpdatePhase)
The XRInteractionManager or containing IXRInteractionGroup 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
PushRaycastLayerMask()
Passes raycast layer mask properties to the Gesture Recognizers.
Declaration
protected virtual void PushRaycastLayerMask()
See Also
PushRaycastTriggerInteraction()
Passes raycast trigger interaction properties to the Gesture Recognizers.
Declaration
protected virtual void PushRaycastTriggerInteraction()
See Also
PushXROrigin()
Passes the xrOrigin to the Gesture Recognizers.
Declaration
protected virtual void PushXROrigin()
See Also
UpdateGestureRecognizers()
Update all Gesture Recognizers.
Declaration
protected virtual void UpdateGestureRecognizers()