GoogleARCore.Examples.ObjectManipulation.TwistGesture.CalculateDeltaRotation(UnityEngine.Vector2, UnityEngine.Vector2, UnityEngine.Vector2, UnityEngine.Vector2)

Here are the examples of the csharp api GoogleARCore.Examples.ObjectManipulation.TwistGesture.CalculateDeltaRotation(UnityEngine.Vector2, UnityEngine.Vector2, UnityEngine.Vector2, UnityEngine.Vector2) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 View Source File : TwistGesture.cs
License : GNU General Public License v3.0
Project Creator : ARPOISE

protected internal override bool CanStart()
        {
            if (GestureTouchesUtility.IsFingerIdRetained(FingerId1) ||
                GestureTouchesUtility.IsFingerIdRetained(FingerId2))
            {
                Cancel();
                return false;
            }

            Touch touch1, touch2;
            bool foundTouches = GestureTouchesUtility.TryFindTouch(FingerId1, out touch1);
            foundTouches = GestureTouchesUtility.TryFindTouch(FingerId2, out touch2) && foundTouches;

            if (!foundTouches)
            {
                Cancel();
                return false;
            }

            // Check that both fingers are moving.
            if (touch1.deltaPosition == Vector2.zero || touch2.deltaPosition == Vector2.zero)
            {
                return false;
            }

            TwistGestureRecognizer twistRecognizer = m_Recognizer as TwistGestureRecognizer;

            float rotation = CalculateDeltaRotation(touch1.position, touch2.position, StartPosition1, StartPosition2);
            if (Mathf.Abs(rotation) < twistRecognizer.m_SlopRotation)
            {
                return false;
            }

            return true;
        }

19 View Source File : TwistGesture.cs
License : GNU General Public License v3.0
Project Creator : ARPOISE

protected internal override bool UpdateGesture()
        {
            Touch touch1, touch2;
            bool foundTouches = GestureTouchesUtility.TryFindTouch(FingerId1, out touch1);
            foundTouches = GestureTouchesUtility.TryFindTouch(FingerId2, out touch2) && foundTouches;

            if (!foundTouches)
            {
                Cancel();
                return false;
            }

            if (touch1.phase == TouchPhase.Canceled || touch2.phase == TouchPhase.Canceled)
            {
                Cancel();
                return false;
            }

            if (touch1.phase == TouchPhase.Ended || touch2.phase == TouchPhase.Ended)
            {
                Complete();
                return false;
            }

            if (touch1.phase == TouchPhase.Moved || touch2.phase == TouchPhase.Moved)
            {
                float rotation = CalculateDeltaRotation(
                                     touch1.position,
                                     touch2.position,
                                     m_PreviousPosition1,
                                     m_PreviousPosition2);

                DeltaRotation = rotation;
                m_PreviousPosition1 = touch1.position;
                m_PreviousPosition2 = touch2.position;
                return true;
            }

            m_PreviousPosition1 = touch1.position;
            m_PreviousPosition2 = touch2.position;
            DeltaRotation = 0.0f;
            return false;
        }