コード例 #1
0
 private void SetCameraLookTarget()
 {
     if (animator != null)
     {
         var spineTransform = animator.GetBoneTransform(HumanBodyBones.Spine);
         var calcPosition   = Vector3.Lerp(animator.GetBoneTransform(HumanBodyBones.Head).position, spineTransform.position, 0.5f);
         var gameObject     = new GameObject("CameraLook");
         gameObject.transform.position = calcPosition;
         gameObject.transform.rotation = spineTransform.rotation;
         gameObject.transform.parent   = /* bodyTracker == null ? animator.GetBoneTransform(HumanBodyBones.Spine) :*/ CurrentModel.transform;
         var lookTarget = FrontCamera.GetComponent <CameraMouseControl>();
         if (lookTarget != null)
         {
             lookTarget.LookTarget = gameObject.transform;
         }
         lookTarget = BackCamera.GetComponent <CameraMouseControl>();
         if (lookTarget != null)
         {
             lookTarget.LookTarget = gameObject.transform;
         }
         var positionFixedCamera = PositionFixedCamera.GetComponent <CameraMouseControl>();
         if (positionFixedCamera != null)
         {
             positionFixedCamera.PositionFixedTarget = gameObject.transform;
         }
     }
 }
コード例 #2
0
        private IEnumerator SetExternalCameraConfig(PipeCommands.SetExternalCameraConfig d)
        {
            //フリーカメラに変更
            ChangeCamera(CameraTypes.Free);
            FreeCamera.GetComponent <CameraMouseControl>().enabled = false;
            //externalcamera.cfgは3つ目のコントローラー基準のポジション
            yield return(null);

            //指定のコントローラーの子にして座標指定
            CurrentCameraControl.transform.SetParent(TrackingPointManager.Instance.GetTransform(d.ControllerName));
            CurrentCameraControl.transform.localPosition = new Vector3(d.x, d.y, d.z);
            CurrentCameraControl.transform.localRotation = Quaternion.Euler(d.rx, d.ry, d.rz);
            ControlCamera.fieldOfView = d.fov;
            //コントローラーは動くのでカメラ位置の保存はできない
            //if (Settings.Current.FreeCameraTransform == null) Settings.Current.FreeCameraTransform = new StoreTransform(currentCamera.transform);
            //Settings.Current.FreeCameraTransform.SetPosition(currentCamera.transform);
        }
コード例 #3
0
        private void SetCameraEnable(CameraMouseControl camera)
        {
            if (camera != null)
            {
                var virtualCam = ControlCamera.GetComponent <VirtualCamera>();
                if (virtualCam != null)
                {
                    virtualCam.enabled = Settings.Current.WebCamEnabled;
                }
                camera.gameObject.SetActive(true);
                if (CurrentCameraControl != null && CurrentCameraControl != camera)
                {
                    CurrentCameraControl.gameObject.SetActive(false);
                }
                camera.GetComponent <CameraMouseControl>().enabled = true;
                CurrentCameraControl = camera;
                SetCameraMirrorEnable(Settings.Current.CameraMirrorEnable);

                VMCEvents.OnCameraChanged?.Invoke(ControlCamera);
            }
        }