Example #1
0
        /// <summary>
        /// Returns true if the manipulation can be started for the given Twist gesture.
        /// </summary>
        /// <param name="gesture">The current gesture.</param>
        /// <returns>True if the manipulation can be started.</returns>
        protected override bool CanStartManipulationForGesture(TwistGesture gesture)
        {
            if (!IsSelected())
            {
                return(false);
            }

            if (gesture.TargetObject != null)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        private void OnGestureStarted(TwistGesture gesture)
        {
            if (m_IsManipulating)
            {
                return;
            }

            if (CanStartManipulationForGesture(gesture))
            {
                m_IsManipulating    = true;
                gesture.onUpdated  += OnUpdated;
                gesture.onFinished += OnFinished;
                OnStartManipulation(gesture);
            }
        }
Example #3
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);
        }
Example #4
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);
 }
Example #5
0
 private void OnFinished(TwistGesture gesture)
 {
     m_IsManipulating = false;
     OnEndManipulation(gesture);
 }
Example #6
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.
 }
Example #7
0
        /// <summary>
        /// Rotates the object around the y-axis via a Twist gesture.
        /// </summary>
        /// <param name="gesture">The current twist gesture.</param>
        protected override void OnContinueManipulation(TwistGesture gesture)
        {
            float rotationAmount = -gesture.DeltaRotation * k_RotationRateDegreesTwist;

            transform.Rotate(0.0f, rotationAmount, 0.0f);
        }