Пример #1
0
        public static void BeingDragCamera(Cam2 camera)
        {
            if (grabbedCamera != null)
            {
                FinishCameraMove();
            }

            var controllers = Resources.FindObjectsOfTypeAll <VRLaserPointer>();

            controller = (!HookFPFCToggle.isInFPFC ?
                          controllers.LastOrDefault(x => x.isActiveAndEnabled) :
                          controllers.LastOrDefault(x =>
            {
                var controllerTransform = x.transform;
                return(controllerTransform.eulerAngles + controllerTransform.position != Vector3.zero);
            })
                          )?.GetComponentInParent <VRController>();

            if (controller == null)
            {
                return;
            }

            //TODO: I should probably move this to use a Transformer...
            grabbedCamera = camera;
            camTransform  = camera.UCamera.transform;

            grabStartPos = controller.transform.InverseTransformPoint(camTransform.position);
            grabStartRot = Quaternion.Inverse(controller.rotation) * camTransform.rotation;

            grabbedCamera.worldCam.SetPreviewPositionAndSize(false);
        }
Пример #2
0
        public void SetSource(Cam2 cam)
        {
            this.cam = cam;

            viewMaterial.SetTexture(MainTex, cam.renderTexture);
            SetPreviewPositionAndSize();
        }
Пример #3
0
        public void Init(Cam2 cam, Transform parent, bool worldPositionStays, bool unparentOnDisable = false)
        {
            this.cam = cam;
            this.unparentOnDisable = unparentOnDisable;

            transform.SetParent(parent, worldPositionStays);
        }
        public void SetSource(Cam2 cam)
        {
            this.cam = cam;

            texture = cam.renderTexture;

            rekt.anchorMin = cam.settings.viewRect.MinAnchor();
            rekt.anchorMax = cam.settings.viewRect.MaxAnchor();

            rekt.anchoredPosition = new Vector2(0, 0);
            gameObject.name       = cam.name;
        }
Пример #5
0
        private static void FinishCameraMove()
        {
            if (grabbedCamera == null)
            {
                return;
            }

            grabbedCamera.settings.targetPos = grabbedCamera.transformer.position;
            grabbedCamera.settings.targetRot = grabbedCamera.transformer.rotation.eulerAngles;

            grabbedCamera.settings.ApplyPositionAndRotation();

            grabbedCamera.worldCam.SetPreviewPositionAndSize(true);

            grabbedCamera.settings.Save();

            grabbedCamera = null;
        }