docs.unity3d.com
    Show / Hide Table of Contents

    Class PinchGesture

    Gesture for when the user performs a two-finger pinch motion on the touch screen.

    Inheritance
    Object
    Gesture<PinchGesture>
    PinchGesture
    Inherited Members
    Gesture<PinchGesture>.onStart
    Gesture<PinchGesture>.onUpdated
    Gesture<PinchGesture>.onFinished
    Gesture<PinchGesture>.isCanceled
    Gesture<PinchGesture>.targetObject
    Gesture<PinchGesture>.recognizer
    Gesture<PinchGesture>.Complete()
    Gesture<PinchGesture>.WasCancelled
    Gesture<PinchGesture>.TargetObject
    Gesture<PinchGesture>.m_Recognizer
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.AR
    Syntax
    public class PinchGesture : Gesture<PinchGesture>

    Constructors

    PinchGesture(PinchGestureRecognizer, Touch, Touch)

    Initializes and returns an instance of PinchGesture.

    Declaration
    public PinchGesture(PinchGestureRecognizer recognizer, Touch touch1, Touch touch2)
    Parameters
    Type Name Description
    PinchGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch1

    The first touch that started this gesture.

    Touch touch2

    The second touch that started this gesture.

    PinchGesture(PinchGestureRecognizer, Touch, Touch)

    Initializes and returns an instance of PinchGesture.

    Declaration
    public PinchGesture(PinchGestureRecognizer recognizer, Touch touch1, Touch touch2)
    Parameters
    Type Name Description
    PinchGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch1

    The first touch that started this gesture.

    Touch touch2

    The second touch that started this gesture.

    Properties

    fingerId1

    (Read Only) The id of the first finger used in this gesture.

    Declaration
    public int fingerId1 { get; }
    Property Value
    Type Description
    Int32

    fingerId2

    (Read Only) The id of the second finger used in this gesture.

    Declaration
    public int fingerId2 { get; }
    Property Value
    Type Description
    Int32

    gap

    (Read Only) The gap between then position of the first and second fingers.

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

    gapDelta

    (Read Only) The gap delta between then position of the first and second fingers.

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

    pinchRecognizer

    (Read Only) The gesture recognizer.

    Declaration
    protected PinchGestureRecognizer pinchRecognizer { get; }
    Property Value
    Type Description
    PinchGestureRecognizer

    startPosition1

    (Read Only) The screen position of the first finger where the gesture started.

    Declaration
    public Vector2 startPosition1 { get; }
    Property Value
    Type Description
    Vector2

    startPosition2

    (Read Only) The screen position of the second finger where the gesture started.

    Declaration
    public Vector2 startPosition2 { get; }
    Property Value
    Type Description
    Vector2

    Methods

    CanStart()

    Returns true if this gesture can start.

    Declaration
    protected override bool CanStart()
    Returns
    Type Description
    Boolean

    Returns true if the gesture can start. Otherwise, returns false.

    Overrides
    UnityEngine.XR.Interaction.Toolkit.AR.Gesture<UnityEngine.XR.Interaction.Toolkit.AR.PinchGesture>.CanStart()

    OnCancel()

    This method is called automatically when this gesture is canceled.

    Declaration
    protected override void OnCancel()
    Overrides
    UnityEngine.XR.Interaction.Toolkit.AR.Gesture<UnityEngine.XR.Interaction.Toolkit.AR.PinchGesture>.OnCancel()
    Remarks

    When canceled, this method is called right before OnFinish(), which is still invoked.

    OnFinish()

    This method is called automatically when this gesture is finished.

    Declaration
    protected override void OnFinish()
    Overrides
    UnityEngine.XR.Interaction.Toolkit.AR.Gesture<UnityEngine.XR.Interaction.Toolkit.AR.PinchGesture>.OnFinish()

    OnStart()

    This method is called automatically when this gesture is started.

    Declaration
    protected override void OnStart()
    Overrides
    UnityEngine.XR.Interaction.Toolkit.AR.Gesture<UnityEngine.XR.Interaction.Toolkit.AR.PinchGesture>.OnStart()

    UpdateGesture()

    Updates this gesture.

    Declaration
    protected override bool UpdateGesture()
    Returns
    Type Description
    Boolean

    Returns true if the update was successful. Otherwise, returns false.

    Overrides
    UnityEngine.XR.Interaction.Toolkit.AR.Gesture<UnityEngine.XR.Interaction.Toolkit.AR.PinchGesture>.UpdateGesture()
    Back to top
    Terms of use
    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