protected Vector3 GetInputTranslation() { // Get the fingers we want to use var fingers = Use.GetFingers(); //ignore panning with middlebutton if over ui if (fingers.Count == 0 && LeanTouch.PointOverGui(Input.mousePosition)) { return(new Vector3()); } // Get current point and previous point var lastScreenPoint = Lean.Touch.LeanGesture.GetLastScreenCenter(fingers); var screenPoint = Lean.Touch.LeanGesture.GetScreenCenter(fingers); //if using middle mouse button for panning if (Input.GetMouseButton(2)) { lastScreenPoint = InputController.LastMousePosition; screenPoint = InputController.MousePosition; } // Get the world delta of them after conversion var worldDelta = ScreenDepth.ConvertDelta(lastScreenPoint, screenPoint, gameObject); // Pan the camera based on the world delta var movement = worldDelta * PanSensitivity; return(movement); }
protected float GetInputZoom() { // Get the fingers we want to use var fingers = Use.GetFingers(); //ignore zoom with scrollwheel if over ui if (fingers.Count == 0 && LeanTouch.PointOverGui(Input.mousePosition)) { return(0); } // Get current point and previous point var lastScreenPoint = Lean.Touch.LeanGesture.GetLastScreenCenter(fingers); var screenPoint = Lean.Touch.LeanGesture.GetScreenCenter(fingers); var pinchScale = Lean.Touch.LeanGesture.GetPinchScale(fingers, -ZoomSensitivity * 0.04f); return((1 - Mathf.Clamp(pinchScale, 0, 2)) * ZoomSensitivity); }