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); }