Exemplo n.º 1
0
        //UnHook a view to camera
        //hard == true : unhook completely (both moving and rotating)
        //hard == false : unhook only rotation
        public void UnHookView(bool hard = true)
        {
            if (hard)
            {
                currentView = null;
                unhookCallback?.Invoke();
                movingTarget = null;
                //UITextManager.SetText("CameraNameUIText", "Free Camera");
            }
            isFreeRotation = !hard;

            /*
             * cam.fieldOfView = defaultSetting.fieldOfView;
             * cam.nearClipPlane = defaultSetting.clippingPlanes.near;
             * cam.farClipPlane = defaultSetting.clippingPlanes.far;
             */
        }
Exemplo n.º 2
0
        private void Update()
        {
            flag = false;

            if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1) && touchList.Count == 0)
            {
                isMouseOverUI = false;
            }

            if (/*(EventSystem.current.IsPointerOverGameObject() || */ IsPointerOverUIObject())
            {
                isMouseOverUI = true;
            }


            GatherTouches();
            if (isMouseOverUI)
            {
                return;
            }

            ProcessMouseInput();
            ProcessMobileInput();

            if (flag)
            {
                userControlledCallback?.Invoke();
            }


            //clamping camera position
            if (boundingBox && movingTarget == null && clampValues != null && clampValues.Length == 6)
            {
                Vector3 pos = cameraTransform.position;
                cameraTransform.position = new Vector3(Mathf.Clamp(pos.x, clampValues[0], clampValues[1]), Mathf.Clamp(pos.y, clampValues[2], clampValues[3]), Mathf.Clamp(pos.z, clampValues[4], clampValues[5]));
            }
        }