/// <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 * _rotationRateDegreesTwist; GameObject.Find("Game Table").GetComponent <PlaceTable>().AddRotation(rotationAmount); //transform.Rotate(0.0f, rotationAmount, 0.0f); }
/// <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) { Debug.Log("OnContinueManipulation TwistGesture"); float rotationAmount = -gesture.DeltaRotation * k_RotationRateDegreesTwist; transform.Rotate(0.0f, rotationAmount, 0.0f); RotationGestureHandler(); }
/// <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; }
private void OnGestureStarted(TwistGesture gesture) { if (m_IsManipulating) { return; } if (CanStartManipulationForGesture(gesture)) { m_IsManipulating = true; gesture.onUpdated += OnUpdated; gesture.onFinished += OnFinished; OnStartManipulation(gesture); } }
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); }
/// <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); } if (checkRotationToggle() == false) { return(false); } return(true); }
/// <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 * _rotationRateDegreesTwist; transform.Rotate(0.0f, rotationAmount, 0.0f); }
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) { // Optional override. }
/// <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); }