private Transform GetCameraParent(CameraParent parent) { Transform parnetTrans = null; _parentDic.TryGetValue(parent, out parnetTrans); return(parnetTrans); }
public DisplayCamera(string name, CameraParent parent, Vector3 position, Vector3 eulerAngles, KeyCode keyCode) { Name = name; Position = position; EulerAngles = eulerAngles; Keycode = keyCode; Parent = parent; }
private Transform GetCameraParent(CameraParent cameraParent) { if (_parentDic.TryGetValue(cameraParent, out Transform camera)) { return(camera); } Debug.LogError("Get GetCameraParent fail:" + cameraParent.ToString()); return(null); }
void Start() { //Init variables targetZoom = (zoomMax + zoomMin) / 2; controller = new GameObject().AddComponent <CameraParent>(); controller.target = target; controller.cam = this; controller.panSpeed = panSpeed; controller.yTargetOffset = yTargetOffset; transform.parent = controller.transform; controller.transform.rotation = Quaternion.Euler(new Vector3(0, yRotOffset, 0)); obstructiveObjects = new List <ObstructionObj>(); }
/// <summary> /// 初期化 /// </summary> void IScene.Initialize() { AudioManager.Instance.FadeIn((int)SceneController.Instance.FadeTime); AudioManager.Instance.Play(AudioManager.SE.GameStart); AudioManager.Instance.Play(AudioManager.BGM.Game); StartTimer = 90; StatusManager.ClearMinitue = 0; StatusManager.ClearSecond = 0; StatusManager.Start_Camera_End = false; StatusManager.Start_Camera_Skip = false; StatusManager.Player_Inoperable_Time = 0; BulletManager.Instance.Initialize(); EnemyManager.Instance.MyStart(); if (player == null) { player = UnityEngine.GameObject.FindObjectOfType <Player>(); } player.Initialized(); Debug.Log("name=" + player.gameObject); if (Timer.Instance == null) { Timer.Instance = UnityEngine.GameObject.FindObjectOfType <Timer>(); } Timer.Instance.MyStart(); if (mainCamera == null) { mainCamera = UnityEngine.GameObject.FindObjectOfType <MainCamera>(); } mainCamera.Initialize(); //追加 if (cameraParent == null) { cameraParent = UnityEngine.GameObject.FindObjectOfType <CameraParent>(); } cameraParent.Initialize(); if (startEvent == null) { startEvent = UnityEngine.GameObject.FindObjectOfType <StartEvent>(); } startEvent.Initialize(); if (readyGo == null) { readyGo = UnityEngine.GameObject.FindObjectOfType <ReadyGo>(); } readyGo.Initialize(); }
private Transform GetParent(CameraParent parent) { Debug.Log($"GetParent:{parent.ToString()}"); switch (parent) { case CameraParent.HAND_R: return(Hand_R); case CameraParent.HAND_L: return(Hand_L); default: return(Head); } }
/// <summary> /// Update is called by the update proxy. /// </summary> private void Update() { ErrorStatus = ""; if (hasPendingLoadTask) { ErrorStatus = "pending background load task"; return; } // AnchorManager.Update takes care of creating anchors&edges and feeding the up-to-date state // into the FrozenWorld engine bool hasSpongyAnchors = AnchorManager.Update(); if (!hasSpongyAnchors) { // IFragmentManager.Pause() will set all fragments to disconnected. ErrorStatus = AnchorManager.ErrorStatus; FragmentManager.Pause(); return; } try { DiagnosticRecordings.Update(); } catch (Exception exception) { Debug.LogErrorFormat("Error writing WorldLocking diagnostics record: {0}", exception); } // The basic output from the FrozenWorld engine (current fragment and its alignment) // are applied to the unity scene FragmentManager.Update(AutoRefreeze, AutoMerge); /// The following assumes a camera hierarchy like this: /// Nodes_A => AdjustmentFrame => Nodes_B => camera /// The cumulative effect of Nodes_B is to transform from Spongy space to playspace. /// Spongy space is the space that the camera moves about in, and is the space that /// coordinates coming from scene agnostic APIs like XR are in. /// (Note the MRTK APIs are in Unity's global space, not Spongy space. /// The internal structure of that graph is inconsequential here, the only dependency /// is on the cumulative transform, PlayspaceFromSpongy. /// Likewise, the cumulative effect of Nodes_A is to transform from alignment space (described below) /// to Unity's global space, referred to here as FrozenSpace. /// The AdjustmentFrame's transform is composed of two transforms. /// The first comes from the FrozenWorld engine DLL as the inverse of Plugin.GetAlignment(), /// and transforms from Playspace to the base stable world locked space, labeled as /// LockedFromPlayspace. /// The second transforms from this stable but arbitrary space to a space locked /// to a finite set of real world markers. This transform is labeled PinnedFromLocked. /// The transform chain equivalent of the above camera hierarchy is: /// FrozenFromPinned * [PinnedFromLocked * LockedFromPlayspace] * PlayspaceFromSpongy * SpongyFromCamera /// /// FrozenFromSpongy and its inverse are useful for converting between the coordinates of scene agnostic APIs (e.g. XR) /// and Frozen coordinates, i.e. Unity's global space. /// FrozenFromLocked is convenient for converting between the "frozen" coordinates of the FrozenWorld engine DLL /// and Unity's global space, i.e. Frozen coordinate. if (Enabled) { Pose playspaceFromLocked = Plugin.GetAlignment(); LockedFromPlayspace = playspaceFromLocked.Inverse(); SpongyFromCamera = Plugin.GetSpongyHead(); Pose playspaceFromSpongy = CameraParent.GetLocalPose(); Pose lockedHeadPose = LockedFromPlayspace.Multiply(playspaceFromSpongy.Multiply(SpongyFromCamera)); alignmentManager.ComputePinnedPose(lockedHeadPose); PinnedFromLocked = alignmentManager.PinnedFromLocked; } else { SpongyFromCamera = Camera.main.transform.GetLocalPose(); /// Note leave adjustment and pinning transforms alone, to facilitate /// comparison of behavior when toggling FW enabled. } AdjustmentFrame.SetLocalPose(PinnedFromLocked.Multiply(LockedFromPlayspace)); AutoSaveTriggerHook(); }