void Start() { inputLock = false; //カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent <FlyThroughCamera>(); pinchZoomCamera = this.gameObject.GetComponent <PinchZoomCamera>(); orbitCamera = this.gameObject.GetComponent <OrbitCamera>(); //初期値を保存 defaultPos = this.gameObject.transform.position; ResetInput(); }
void Start() { //カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent <FlyThroughCamera>(); orbitCamera = this.gameObject.GetComponent <OrbitCamera>(); //ズーム位置のルートを設定する pinchZoomRoot = new GameObject(this.gameObject.name + " PinchZoom Root"); pinchZoomRoot.transform.position = this.gameObject.transform.position; pinchZoomRoot.transform.rotation = this.gameObject.transform.rotation; pinchZoomRoot.transform.localScale = this.gameObject.transform.localScale; pinchZoomRoot.transform.parent = this.gameObject.transform.parent; this.gameObject.transform.parent = pinchZoomRoot.transform; //初期値を保存 switch (zoomType) { case PINCH_ZOOM_TYPE.POSITION_Z: defaultZoom = this.gameObject.transform.localPosition.z; break; case PINCH_ZOOM_TYPE.FOV: defaultZoom = this.gameObject.GetComponent <Camera>().fieldOfView; break; case PINCH_ZOOM_TYPE.ORTHOSIZE: defaultZoom = this.gameObject.GetComponent <Camera>().orthographicSize; break; default: break; } //ピンチセンターへのズーム設定 if (zoomToPinchCenter) { Camera[] cameras = this.gameObject.GetComponent <Camera>().GetComponentsInChildren <Camera>(); foreach (Camera cam in cameras) { CameraShifter cameraShifter = cam.gameObject.GetComponent <CameraShifter>(); if (cameraShifter == null) { cameraShifter = cam.gameObject.AddComponent <CameraShifter>(); } cameraShifter.calcAlways = true; cameraShifterListForZtoPC.Add(cameraShifter); } } ResetInput(); }
void Start() { // 設定ファイルより入力タイプを取得 if (!ApplicationSetting.Instance.GetBool("UseMouse")) { winTouch = true; } inputLock = false; // カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent <FlyThroughCamera>(); pinchZoomCamera = this.gameObject.GetComponent <PinchZoomCamera>(); orbitCamera = this.gameObject.GetComponent <OrbitCamera>(); // 初期値を保存 defaultPos = this.gameObject.transform.position; ResetInput(); }
void Awake() { instance = this; }
IEnumerator Start() { // 設定ファイルより入力タイプを取得 if (!ApplicationSetting.Instance.GetBool("UseMouse")) { winTouch = true; } Vector3 temp_pos = this.gameObject.transform.position; Quaternion temp_rot = this.gameObject.transform.rotation; Vector3 temp_scale = this.gameObject.transform.localScale; yield return(new WaitForEndOfFrame()); // カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent <FlyThroughCamera>(); orbitCamera = this.gameObject.GetComponent <OrbitCamera>(); // ズーム位置のルートを設定する pinchZoomRoot = new GameObject(this.gameObject.name + " PinchZoom Root"); pinchZoomRoot.transform.SetParent(this.gameObject.transform.parent, true); pinchZoomRoot.transform.position = temp_pos; pinchZoomRoot.transform.rotation = temp_rot; pinchZoomRoot.transform.localScale = temp_scale; this.gameObject.transform.SetParent(pinchZoomRoot.transform, true); this.gameObject.transform.localPosition = Vector3.zero; this.gameObject.transform.localRotation = Quaternion.identity; this.gameObject.transform.localScale = Vector3.one; // 初期値を保存 switch (zoomType) { case PINCH_ZOOM_TYPE.POSITION_Z: defaultZoom = this.gameObject.transform.localPosition.z; break; case PINCH_ZOOM_TYPE.FOV: defaultZoom = this.gameObject.GetComponent <Camera>().fieldOfView; break; case PINCH_ZOOM_TYPE.ORTHOSIZE: defaultZoom = this.gameObject.GetComponent <Camera>().orthographicSize; break; default: break; } // ピンチセンターへのズーム設定 if (zoomToPinchCenterFor2D) { if (zoomType != PINCH_ZOOM_TYPE.POSITION_Z) { Debug.LogWarning("PinchZoomCamera :: [zoomToPinchCenter] only works for [PINCH_ZOOM_TYPE.POSITION_Z]"); } Camera[] cameras = this.gameObject.GetComponent <Camera>().GetComponentsInChildren <Camera>(); foreach (Camera cam in cameras) { CameraShifter cameraShifter = cam.gameObject.GetComponent <CameraShifter>(); if (cameraShifter == null) { cameraShifter = cam.gameObject.AddComponent <CameraShifter>(); } cameraShifter.calcAlways = true; cameraShifterListForZtoPC.Add(cameraShifter); } } ResetInput(); }
void Start() { inputLock = false; //カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent<FlyThroughCamera>(); pinchZoomCamera = this.gameObject.GetComponent<PinchZoomCamera>(); orbitCamera = this.gameObject.GetComponent<OrbitCamera>(); //初期値を保存 defaultPos = this.gameObject.transform.position; ResetInput(); }
void Start() { //設定ファイルより入力タイプを取得 if(ApplicationSetting.Instance.GetBool("UseMouse")) win7touch = true; //カメラコンポーネントの取得 flyThroughCamera = this.gameObject.GetComponent<FlyThroughCamera>(); orbitCamera = this.gameObject.GetComponent<OrbitCamera>(); //ズーム位置のルートを設定する pinchZoomRoot = new GameObject(this.gameObject.name + " PinchZoom Root"); pinchZoomRoot.transform.position = this.gameObject.transform.position; pinchZoomRoot.transform.rotation= this.gameObject.transform.rotation; pinchZoomRoot.transform.localScale = this.gameObject.transform.localScale; pinchZoomRoot.transform.parent = this.gameObject.transform.parent; this.gameObject.transform.parent = pinchZoomRoot.transform; //初期値を保存 switch(zoomType) { case PINCH_ZOOM_TYPE.POSITION_Z: defaultZoom = this.gameObject.transform.localPosition.z; break; case PINCH_ZOOM_TYPE.FOV: defaultZoom = this.gameObject.camera.fieldOfView; break; case PINCH_ZOOM_TYPE.ORTHOSIZE: defaultZoom = this.gameObject.camera.orthographicSize; break; default: break; } //ピンチセンターへのズーム設定 if(zoomToPinchCenter) { Camera[] cameras = this.gameObject.camera.GetComponentsInChildren<Camera>(); foreach(Camera cam in cameras) { CameraShifter cameraShifter = cam.gameObject.GetComponent<CameraShifter>(); if(cameraShifter == null) cameraShifter = cam.gameObject.AddComponent<CameraShifter>(); cameraShifter.calcAlways = true; cameraShifterListForZtoPC.Add(cameraShifter); } } ResetInput(); }