docs.unity3d.com
    Show / Hide Table of Contents

    Class GestureRecognizer<T>

    A Gesture Recognizer processes touch input to determine if a gesture should start and fires an event when the gesture is started.

    Inheritance
    Object
    GestureRecognizer<T>
    DragGestureRecognizer
    PinchGestureRecognizer
    TapGestureRecognizer
    TwistGestureRecognizer
    TwoFingerDragGestureRecognizer
    Namespace: UnityEngine.XR.Interaction.Toolkit.AR
    Syntax
    public abstract class GestureRecognizer<T> : object where T : Gesture<T>
    Type Parameters
    Name Description
    T

    The actual gesture.

    Remarks

    To determine when a gesture is finished/updated, listen to events on the Gesture<T> object.

    Fields

    m_Gestures

    (Deprecated) List of current active gestures.

    Declaration
    protected List<T> m_Gestures
    Field Value
    Type Description
    List<T>

    Properties

    arSessionOrigin

    The that will be used by gestures (such as to get the or to transform from Session space).

    Declaration
    public ARSessionOrigin arSessionOrigin { get; set; }
    Property Value
    Type Description
    ARSessionOrigin

    gestures

    List of current active gestures.

    Declaration
    protected List<T> gestures { get; }
    Property Value
    Type Description
    List<T>
    Remarks

    Gestures must be added or removed using AddGesture(T) and RemoveGesture(T) rather than by directly modifying this list. This list should be treated as read-only.

    See Also
    AddGesture(T)
    RemoveGesture(T)

    Methods

    AddGesture(T)

    Add the given gesture to be managed so that it can be updated during Update().

    Declaration
    protected void AddGesture(T gesture)
    Parameters
    Type Name Description
    T gesture

    The gesture to add.

    See Also
    RemoveGesture(T)

    RemoveGesture(T)

    Remove the given gesture from being managed. After being removed, it will no longer be updated during Update().

    Declaration
    protected void RemoveGesture(T gesture)
    Parameters
    Type Name Description
    T gesture

    The gesture to remove.

    See Also
    AddGesture(T)

    TryCreateGestures()

    Try to recognize and create gestures.

    Declaration
    protected abstract void TryCreateGestures()

    TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T>)

    Helper function for creating one finger gestures when a touch begins.

    Declaration
    protected void TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T> createGestureFunction)
    Parameters
    Type Name Description
    Func<InputSystem.EnhancedTouch.Touch, T> createGestureFunction

    Function to be executed to create the gesture.

    TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>)

    Helper function for creating one finger gestures when a touch begins.

    Declaration
    protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction)
    Parameters
    Type Name Description
    Func<Touch, T> createGestureFunction

    Function to be executed to create the gesture.

    TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T>)

    Helper function for creating two finger gestures when a touch begins.

    Declaration
    protected void TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T> createGestureFunction)
    Parameters
    Type Name Description
    Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T> createGestureFunction

    Function to be executed to create the gesture.

    TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)

    Helper function for creating two finger gestures when a touch begins.

    Declaration
    protected void TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T> createGestureFunction)
    Parameters
    Type Name Description
    Func<Touch, Touch, T> createGestureFunction

    Function to be executed to create the gesture.

    Update()

    Instantiate and update all gestures.

    Declaration
    public void Update()

    Events

    onGestureStarted

    Calls the methods in its invocation list when a gesture is started. To receive an event when the gesture is finished/updated, listen to events on the Gesture<T> object.

    Declaration
    public event Action<T> onGestureStarted
    Event Type
    Type Description
    Action<T>
    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