void Awake() { anim = GetComponent<Animator>(); //*** Eyes { GameObject leftEyeGO = MiscUtils.FindChildInHierarchy(gameObject, "EyeLeft"); if (leftEyeGO) { ownEyeLeftTransform = leftEyeGO.transform; ownEyeRightTransform = MiscUtils.FindChildInHierarchy(gameObject, "EyeRight").transform; // The eyesRootTransform will be the reference transform to move the eyes in. // We could use the head bone, but that might have a weird orientation eyesRootTransform = new GameObject(name + "_eyesRoot").transform; eyesRootTransform.position = 0.5f * (ownEyeLeftTransform.position + ownEyeRightTransform.position); eyesRootTransform.rotation = ownEyeLeftTransform.rotation; eyesRootTransform.parent = ownEyeLeftTransform.parent; ownEyeLeftTransform.parent = ownEyeRightTransform.parent = eyesRootTransform; } } cameraControlTwoPerspectives = MiscUtils.GetComponentSafely<CameraControlTwoPerspectives>("CameraControls"); targetHead = targetBodyTransform.GetComponentInChildren<Head>(); isSocrates = transform.parent.name == "Socrates"; }
void Awake() { anim = GetComponent <Animator>(); //*** Eyes { GameObject leftEyeGO = MiscUtils.FindChildInHierarchy(gameObject, "EyeLeft"); if (leftEyeGO) { ownEyeLeftTransform = leftEyeGO.transform; ownEyeRightTransform = MiscUtils.FindChildInHierarchy(gameObject, "EyeRight").transform; // The eyesRootTransform will be the reference transform to move the eyes in. // We could use the head bone, but that might have a weird orientation eyesRootTransform = new GameObject(name + "_eyesRoot").transform; eyesRootTransform.position = 0.5f * (ownEyeLeftTransform.position + ownEyeRightTransform.position); eyesRootTransform.rotation = ownEyeLeftTransform.rotation; eyesRootTransform.parent = ownEyeLeftTransform.parent; ownEyeLeftTransform.parent = ownEyeRightTransform.parent = eyesRootTransform; } } cameraControlTwoPerspectives = MiscUtils.GetComponentSafely <CameraControlTwoPerspectives>("CameraControls"); targetHead = targetBodyTransform.GetComponentInChildren <Head>(); isSocrates = transform.parent.name == "Socrates"; }
void Awake() { characters[0] = GameObject.Find("Carl").transform; characters[1] = GameObject.Find("Socrates").transform; GameObject cameraPivotGO = GameObject.Find("CameraPivot_TwoPerspectives"); cameraPivotTransform = cameraPivotGO.transform; cameraControl = cameraPivotTransform.GetComponentInChildren <CameraControlTwoPerspectives>(); cameraControl.OnPerspectiveChange += OnPerspectiveChange; cameraTransform = cameraControl.transform.Find("OVRCameraRig"); playerCamera = cameraTransform.GetComponent <MainCameraBase> (); darkness = GameObject.Find("OVRCameraRig").transform.Find("TrackingSpace/CenterEyeAnchor/Darkness").GetComponent <HoloGrid>(); }
void OnPerspectiveChange(CameraControlTwoPerspectives.PerspectiveEvent perspectiveEvent) { bool finishedIntoFirst = perspectiveEvent == CameraControlTwoPerspectives.PerspectiveEvent.ZoomedIntoFirstPerson; bool finishedIntoThird = perspectiveEvent == CameraControlTwoPerspectives.PerspectiveEvent.ZoomedIntoThirdPerson; bool changedCharacter = perspectiveEvent == CameraControlTwoPerspectives.PerspectiveEvent.SwooshedToCharacter; if ( state == State.ZoomingOutOfCharacter && finishedIntoThird ) { Transform otherCharacterCameraAnchor = characters[ characterIndex == 0 ? 1 : 0 ].GetComponentInChildren<CameraAnchor>().transform; SwooshToCharacter( otherCharacterCameraAnchor ); } else if ( state == State.ChangingCharacter && changedCharacter ) { InitializeForNewCharacter( characterIndex == 0 ? 1 : 0 ); ZoomIntoCharacter(); } else if ( state == State.ZoomingIntoCharacter && finishedIntoFirst ) { notepad.inputEnabled = true; state = State.InCharacter; } }
void Awake() { characters[0] = GameObject.Find("Carl").transform; characters[1] = GameObject.Find("Socrates").transform; GameObject cameraPivotGO = GameObject.Find("CameraPivot_TwoPerspectives"); cameraPivotTransform = cameraPivotGO.transform; cameraControl = cameraPivotTransform.GetComponentInChildren<CameraControlTwoPerspectives>(); cameraControl.OnPerspectiveChange += OnPerspectiveChange; cameraTransform = cameraControl.transform.Find("OVRCameraRig"); playerCamera = cameraTransform.GetComponent<MainCameraBase> (); darkness = GameObject.Find("OVRCameraRig").transform.Find("TrackingSpace/CenterEyeAnchor/Darkness").GetComponent<HoloGrid>(); }