private void Awake() { // Required Component: VRTK_PlayerPresence playerPresence = GetComponent <VRTK_PlayerPresence>(); if (useGravity) { if (!playerPresence) { playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>(); } playerPresence.SetFallingPhysicsOnlyParams(true); } headCamera = VRTK_DeviceFinder.HeadsetTransform(); headsetCollision = headCamera.GetComponent <VRTK_HeadsetCollision>(); if (headsetCollision == null) { headsetCollision = headCamera.gameObject.AddComponent <VRTK_HeadsetCollision>(); } headsetFade = headCamera.GetComponent <VRTK_HeadsetFade>(); if (headsetFade == null) { headsetFade = headCamera.gameObject.AddComponent <VRTK_HeadsetFade>(); } }
private void OnEnable() { headsetCollision = gameObject.AddComponent <VRTK_HeadsetCollision>(); headsetCollision.ignoreTargetWithTagOrClass = ignoreTargetWithTagOrClass; headsetCollision.targetTagOrScriptListPolicy = targetTagOrScriptListPolicy; headsetFade = gameObject.AddComponent <VRTK_HeadsetFade>(); headsetCollision.HeadsetCollisionDetect += new HeadsetCollisionEventHandler(OnHeadsetCollisionDetect); headsetCollision.HeadsetCollisionEnded += new HeadsetCollisionEventHandler(OnHeadsetCollisionEnded); }
private IEnumerator EnableAtEndOfFrame() { if (basicTeleport == null) { yield break; } yield return(new WaitForEndOfFrame()); headset = VRTK_ObjectCache.registeredHeadsetCollider; if (headset) { headset.HeadsetCollisionDetect += new HeadsetCollisionEventHandler(DisableTeleport); headset.HeadsetCollisionEnded += new HeadsetCollisionEventHandler(EnableTeleport); } }