private void OnUpdatePinch(float fDistance) { float fZoomAverage = PrimitiveHelper.GetCalcReverseFloat(_fStartPinchZoomSize, fDistance); fZoomAverage = Mathf.Clamp(fZoomAverage, p_iCameraZoomMin, p_iCameraZoomMax); if (_bIsCameraOrtho) { _pCamera.orthographicSize = fZoomAverage; } else { // 터치 2개 중앙부터 Plane 까지 쏜 좌표값 구하기 Vector3 v3CenterRayPos = PrimitiveHelper.GetPlaneRaycastPos(_sPlaneCurrentAxis, _pCamera.ScreenPointToRay(PrimitiveHelper.GetCenterByResolution())); _pTransCamera.position = v3CenterRayPos - _pTransCamera.forward * fZoomAverage; } if (p_fZoomSmoothFactor > 0f) { _fLerpPinchDistance = Mathf.Lerp(_fLerpPinchDistance, fDistance, Time.deltaTime * p_fZoomSmoothFactor); } else { _fLerpPinchDistance = fDistance; } }
private void OnStartPinch(float fDistance) { _fLerpPinchDistance = fDistance; _fStartPinchDistance = fDistance; if (_bIsCameraOrtho) { _fStartPinchZoomSize = _pCamera.orthographicSize; } else { Vector3 v3CenterRayPos = PrimitiveHelper.GetPlaneRaycastPos(_sPlaneCurrentAxis, _pCamera.ScreenPointToRay(PrimitiveHelper.GetCenterByResolution())); float fCameraToPlaneDistance = (v3CenterRayPos - _pTransCamera.position).magnitude; _fStartPinchZoomSize = fCameraToPlaneDistance; } }