예제 #1
0
    void OnTwist(TwistGesture gesture)
    {
        if (gesture.Phase == ContinuousGesturePhase.Started)
        {
            UI.StatusText = "Twist gesture started";
            Rotating      = true;
        }
        else if (gesture.Phase == ContinuousGesturePhase.Updated)
        {
            if (Rotating)
            {
                UI.StatusText = "Rotation updated by " + gesture.DeltaRotation + " degrees";

                // apply a rotation around the Z axis by rotationAngleDelta degrees on our target object
                target.Rotate(0, 0, gesture.DeltaRotation);
            }
        }
        else
        {
            if (Rotating)
            {
                UI.StatusText = "Rotation gesture ended. Total rotation: " + gesture.TotalRotation;
                Rotating      = false;
            }
        }
    }
예제 #2
0
        public void OnTwist(TwistGesture twist)
        {
            InputMessage.MessageTypes type = InputMessage.MessageTypes.Failed;

            switch (twist.Phase)
            {
            case ContinuousGesturePhase.Started:
                type = InputMessage.MessageTypes.Begin;
                break;

            case ContinuousGesturePhase.Updated:
                type = InputMessage.MessageTypes.Update;
                break;

            case ContinuousGesturePhase.Ended:
                type = InputMessage.MessageTypes.End;
                break;

            default:
                break;
            }

            _updates.Add(new InputMessage(
                             InputMessage.InputTypes.TwoFingerTwist,
                             type,
                             twist.Fingers.Select(f => f.Position).ToList(),
                             twist.Fingers.Select(f => f.DeltaPosition).ToList(),
                             new List <float> {
                twist.DeltaRotation
            }
                             ));
        }
예제 #3
0
    void OnTwist( TwistGesture gesture )
    {
        if( gesture.Phase == ContinuousGesturePhase.Started )
        {
            UI.StatusText = "Twist gesture started";
            Rotating = true;
        }
        else if( gesture.Phase == ContinuousGesturePhase.Updated )
        {
            if( Rotating )
            {
                UI.StatusText = "Rotation updated by " + gesture.DeltaRotation + " degrees";

                // apply a rotation around the Z axis by rotationAngleDelta degrees on our target object
                target.Rotate( 0, 0, gesture.DeltaRotation );
            }
        }
        else
        {
            if( Rotating )
            {
                UI.StatusText = "Rotation gesture ended. Total rotation: " + gesture.TotalRotation;
                Rotating = false;
            }
        }
    }
예제 #4
0
 void TwistEventHandler(TwistGesture gesture)
 {
     if (twistMethods != null)
     {
         twistMethods(gesture.Position, gesture.Selection, gesture.DeltaRotation, gesture.TotalRotation);
     }
 }
예제 #5
0
    // event message sent by FingerGestures
    void OnTwist(TwistGesture gesture)
    {
        // rotate around current rotation axis by amount proportional to rotation gesture's angle delta
        Quaternion qRot = Quaternion.AngleAxis(Sensitivity * gesture.DeltaRotation, GetRotationAxis());

        // apply rotation to current object
        transform.rotation = qRot * transform.rotation;
    }
예제 #6
0
    // event message sent by FingerGestures
    void OnTwist( TwistGesture gesture )
    {
        // rotate around current rotation axis by amount proportional to rotation gesture's angle delta
        Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, GetRotationAxis() );

        // apply rotation to current object
        transform.rotation = qRot * transform.rotation;
    }
    void OnTwist(TwistGesture gesture)
    {
        //if( gesture.Selection )
        //    LogUtil.Log( "Twist object: " + gesture.Selection.name );
        //else
        //    LogUtil.Log( "No object was twisted at " + gesture.Position );

        Messenger <TwistGesture> .Broadcast(FingerGesturesMessages.OnTwist, gesture);
    }
        // event message sent by FingerGestures
        void TwistUpdate(TwistGesture gesture)
        {
            if (!GestureRunning) return;
            // rotate around current rotation axis by amount proportional to rotation gesture's angle delta
            Quaternion qRot = Quaternion.AngleAxis(_sensitivity * gesture.DeltaRotation,_rotationAxis);

            // apply rotation to current object
            TargetTransform.rotation = qRot * TargetTransform.rotation;
        }
        void TwistStart(TwistGesture gesture)
        {
            if (!GlobalManager.FurnitureOperationSwitch) return;
            if(gesture.Selection != GlobalManager.Selection) return;

            GestureRunning = IsTargetNull() ? false : true;
            if (!GestureRunning) return;
            StartChange();
        }
        private void OnSceneTwist(TwistGesture twistGesture)
        {
            if (!EnableGesture)
            {
                return;
            }

            //Debug.LogErrorFormat ("{0}->OnSceneSwipe: pos: {1}, direction: {2}, velocity: {3}", GetType ().Name, swipeGesture.Position, swipeGesture.Direction, swipeGesture.Velocity);

            twistGestureSignal.Dispatch(twistGesture);
        }
예제 #11
0
        private void OnGestureStarted(TwistGesture gesture)
        {
            if (m_IsManipulating)
            {
                return;
            }

            if (CanStartManipulationForGesture(gesture))
            {
                m_IsManipulating    = true;
                gesture.onUpdated  += OnUpdated;
                gesture.onFinished += OnFinished;
                OnStartManipulation(gesture);
            }
        }
        void OnUpdated(TwistGesture gesture)
        {
            if (!m_IsManipulating)
            {
                return;
            }

            // Can only transform selected Items.
            if (!IsGameObjectSelected())
            {
                m_IsManipulating = false;
                OnEndManipulation(gesture);
                return;
            }

            OnContinueManipulation(gesture);
        }
예제 #13
0
        private void OnUpdated(TwistGesture gesture)
        {
            if (!m_IsManipulating)
            {
                return;
            }

            // Can only transform selected Items.
            if (ManipulationSystem.Instance.SelectedObject != gameObject)
            {
                m_IsManipulating = false;
                OnEndManipulation(gesture);
                return;
            }

            OnContinueManipulation(gesture);
        }
예제 #14
0
    void OnTwist(TwistGesture gesture)
    {
        ContinuousGesturePhase phase = gesture.Phase;

        if (phase == ContinuousGesturePhase.Started)
        {
            twisting = true;
        }

        if (gesture.Position.y <= (Screen.height * 0.845f))
        {
            CameraDummy.transform.Rotate(0.0f, gesture.DeltaRotation, 0.0f);
            UpdateTargetOffset();
        }

        if (phase == ContinuousGesturePhase.Ended)
        {
            twisting = false;
        }
    }
예제 #15
0
 /// <summary>
 /// Returns true if the manipulation can be started for the given gesture.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 /// <returns>True if the manipulation can be started.</returns>
 protected virtual bool CanStartManipulationForGesture(TwistGesture gesture)
 {
     return(false);
 }
예제 #16
0
 private void OnFinished(TwistGesture gesture)
 {
     m_IsManipulating = false;
     OnEndManipulation(gesture);
 }
 /// <summary>
 /// Function called when the manipulation is ended.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnEndManipulation(TwistGesture gesture)
 {
 }
예제 #18
0
 void OnTwist(TwistGesture gesture)
 {
     //Debug.Log(gesture.TotalRotation);
 }
예제 #19
0
 /// <summary>
 /// Function called when the manipulation is ended.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnEndManipulation(TwistGesture gesture)
 {
     // Optional override.
 }
 /// <summary>
 /// Function called when the manipulation is continued.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnContinueManipulation(TwistGesture gesture)
 {
 }
 /// <summary>
 /// Returns true if the manipulation can be started for the given gesture.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 /// <returns>Returns <see langword="true"/> if the manipulation can be started. Otherwise, returns <see langword="false"/>.</returns>
 protected virtual bool CanStartManipulationForGesture(TwistGesture gesture) => false;
        public void OnTwist(TwistGesture twist)
        {
            InputMessage.MessageTypes type = InputMessage.MessageTypes.Failed;

            switch (twist.Phase) {
                case ContinuousGesturePhase.Started:
                    type = InputMessage.MessageTypes.Begin;
                    break;
                case ContinuousGesturePhase.Updated:
                    type = InputMessage.MessageTypes.Update;
                    break;
                case ContinuousGesturePhase.Ended:
                    type = InputMessage.MessageTypes.End;
                    break;
                default:
                    break;

            }

            _updates.Add(new InputMessage(
                InputMessage.InputTypes.TwoFingerTwist,
                type,
                twist.Fingers.Select(f => f.Position).ToList(),
                twist.Fingers.Select(f => f.DeltaPosition).ToList(),
                new List<float> { twist.DeltaRotation }
            ));
        }
예제 #23
0
 private void OnSceneTwist(TwistGesture twistGesture)
 {
     OnGesture(CocoGestureType.Twist, twistGesture);
 }
 void TwistEnd(TwistGesture gesture)
 {
     if (!GestureRunning) return;
     RecordChange();
 }