protected virtual void Update() { // Get the fingers we want to use var fingers = LeanSelectable.GetFingersOrClear(IgnoreStartedOverGui, IgnoreIsOverGui, RequiredFingerCount, RequiredSelectable); // Calculate the rotation values based on these fingers var twistDegrees = LeanGesture.GetTwistDegrees(fingers); if (Relative == true) { var twistScreenCenter = LeanGesture.GetScreenCenter(fingers); if (transform is RectTransform) { TranslateUI(twistDegrees, twistScreenCenter); RotateUI(twistDegrees); } else { Translate(twistDegrees, twistScreenCenter); Rotate(twistDegrees); } } else { Rotate(twistDegrees); } }
protected virtual void Update() { // Get the fingers we want to use var fingers = LeanSelectable.GetFingersOrClear(IgnoreStartedOverGui, IgnoreIsOverGui, RequiredFingerCount, RequiredSelectable); // Calculate pinch scale, and make sure it's valid var pinchScale = LeanGesture.GetPinchScale(fingers, WheelSensitivity); pinch = pinchScale; if (pinchScale > 0.0f) { // Perform the translation if this is a relative scale if (Relative == true) { var pinchScreenCenter = LeanGesture.GetScreenCenter(fingers); if (transform is RectTransform) { TranslateUI(pinchScale, pinchScreenCenter); } else { Translate(pinchScale, pinchScreenCenter); } } // Perform the scaling Scale(transform.localScale * pinchScale); Debug.Log("Pinch scale:" + pinchScale); } }
protected virtual void Update() { // Get the fingers we want to use var fingers = LeanSelectable.GetFingersOrClear(IgnoreStartedOverGui, IgnoreIsOverGui, RequiredFingerCount, RequiredSelectable); // Calculate the rotation values based on these fingers var twistDegrees = LeanGesture.GetTwistDegrees(fingers); // Perform rotation transform.Rotate(Axis, twistDegrees, Space); }
protected virtual void Update() { // Get the fingers we want to use var fingers = LeanSelectable.GetFingersOrClear(IgnoreStartedOverGui, IgnoreIsOverGui, RequiredFingerCount, RequiredSelectable); // Calculate pinch scale, and make sure it's valid var pinchScale = LeanGesture.GetPinchScale(fingers, WheelSensitivity); if (pinchScale > 0.0f) { // Perform the translation if this is a relative scale if (Relative == true) { var pinchScreenCenter = LeanGesture.GetScreenCenter(fingers); if (transform is RectTransform) { TranslateUI(pinchScale, pinchScreenCenter); } else { Translate(pinchScale, pinchScreenCenter); } } if (Demo01Management.instance.active3D == false) { // Perform the scaling Scale(transform.localScale * pinchScale); } } if (Input.GetMouseButtonUp(0)) { transform.localScale = ScaleMin; } }