docs.unity3d.com
    Show / Hide Table of Contents

    Class TwistGesture

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

    Inheritance
    Object
    Gesture<TwistGesture>
    TwistGesture
    Inherited Members
    Gesture<TwistGesture>.onStart
    Gesture<TwistGesture>.onUpdated
    Gesture<TwistGesture>.onFinished
    Gesture<TwistGesture>.isCanceled
    Gesture<TwistGesture>.targetObject
    Gesture<TwistGesture>.recognizer
    Gesture<TwistGesture>.Complete()
    Gesture<TwistGesture>.WasCancelled
    Gesture<TwistGesture>.TargetObject
    Gesture<TwistGesture>.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 TwistGesture : Gesture<TwistGesture>

    Constructors

    TwistGesture(TwistGestureRecognizer, Touch, Touch)

    Initializes and returns an instance of TwistGesture.

    Declaration
    public TwistGesture(TwistGestureRecognizer recognizer, Touch touch1, Touch touch2)
    Parameters
    Type Name Description
    TwistGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch1

    The first touch that started this gesture.

    Touch touch2

    The second touch that started this gesture.

    TwistGesture(TwistGestureRecognizer, Touch, Touch)

    Initializes and returns an instance of TwistGesture.

    Declaration
    public TwistGesture(TwistGestureRecognizer recognizer, Touch touch1, Touch touch2)
    Parameters
    Type Name Description
    TwistGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch1

    The first touch that started this gesture.

    Touch touch2

    The second touch that started this gesture.

    Properties

    deltaRotation

    (Read Only) The delta rotation of the gesture.

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

    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

    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

    twistRecognizer

    (Read Only) The gesture recognizer.

    Declaration
    protected TwistGestureRecognizer twistRecognizer { get; }
    Property Value
    Type Description
    TwistGestureRecognizer

    Methods

    CalculateDeltaRotation(Vector2, Vector2, Vector2, Vector2)

    Calculates a signed angle for how much to twist according to the movement of two touch positions.

    Declaration
    protected static float CalculateDeltaRotation(Vector2 currentPosition1, Vector2 currentPosition2, Vector2 previousPosition1, Vector2 previousPosition2)
    Parameters
    Type Name Description
    Vector2 currentPosition1

    Current position of the first touch.

    Vector2 currentPosition2

    Current position of the second touch.

    Vector2 previousPosition1

    Previous position of the first touch.

    Vector2 previousPosition2

    Previous position of the second touch.

    Returns
    Type Description
    Single

    A signed angle, in degrees, representing how much to rotate an interactable by according to the changes in the two positions passed in.

    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.TwistGesture>.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.TwistGesture>.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.TwistGesture>.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.TwistGesture>.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.TwistGesture>.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