public static void VrCamera(bool ena) { GameObject player = GameObject.FindGameObjectWithTag("PlayArea"); if (player == null) { return; } VRTK.VRTK_HeightAdjustTeleport heights = player.GetComponent <VRTK.VRTK_HeightAdjustTeleport>(); VRTK.VRTK_BodyPhysics physicses = player.GetComponent <VRTK.VRTK_BodyPhysics>(); VRTK.VRTK_BasicTeleport basics = player.GetComponent <VRTK.VRTK_BasicTeleport>(); if (heights != null) { heights.enabled = ena; } if (physicses != null) { physicses.enabled = ena; } if (basics != null) { basics.enabled = !ena; } }
protected override void OnDisable() { base.OnDisable(); if (initaliseListeners != null) { StopCoroutine(initaliseListeners); } ManageDestinationMarkers(false); if (createdCollider) { Destroy(pointCollider); pointCollider = null; } if (createdRigidbody) { Destroy(pointRigidbody); pointRigidbody = null; } if (!customTeleporter) { teleporter = null; } }
protected virtual void Awake() { bodyPhysics = (bodyPhysics != null ? bodyPhysics : GetComponentInChildren <VRTK_BodyPhysics>()); teleporter = (teleporter != null ? teleporter : GetComponentInChildren <VRTK_BasicTeleport>()); VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this); }
protected virtual void Awake() { bodyPhysics = (bodyPhysics != null ? bodyPhysics : GetComponentInChildren <VRTK_BodyPhysics>()); teleporter = (teleporter != null ? teleporter : GetComponentInChildren <VRTK_BasicTeleport>()); headsetCollision = (headsetCollision != null ? headsetCollision : GetComponentInChildren <VRTK_HeadsetCollision>()); positionRewind = (positionRewind != null ? positionRewind : GetComponentInChildren <VRTK_PositionRewind>()); VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this); }
private void EnableDropToFloor() { initialFloorDrop = false; retogglePhysicsOnCanFall = false; teleporter = GetComponent <VRTK_BasicTeleport>(); if (teleporter) { teleporter.Teleported += Teleporter_Teleported; } }
protected virtual IEnumerator ManageDestinationMarkersAtEndOfFrame() { yield return(new WaitForEndOfFrame()); if (enabled) { ManageDestinationMarkers(true); } teleporter = (teleporter == null && VRTK_ObjectCache.registeredTeleporters.Count > 0 ? VRTK_ObjectCache.registeredTeleporters[0] : teleporter); }
protected virtual void EnableDropToFloor() { initialFloorDrop = false; retogglePhysicsOnCanFall = false; teleporter = GetComponent <VRTK_BasicTeleport>(); if (teleporter != null) { teleporter.Teleported += Teleporter_Teleported; } }
protected void InitTeleportListener(bool state) { teleporter = (teleporter != null ? teleporter : FindObjectOfType <VRTK_BasicTeleport>()); if (teleporter != null) { if (state == true) { teleporter.Teleporting += new TeleportEventHandler(OnTeleport); } else { teleporter.Teleporting -= new TeleportEventHandler(OnTeleport); } } }
protected virtual void Awake() { bodyPhysics = (bodyPhysics != null ? bodyPhysics : FindObjectOfType <VRTK_BodyPhysics>()); if (bodyPhysics == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_PlayerClimb", "VRTK_BodyPhysics")); } teleporter = (teleporter != null ? teleporter : FindObjectOfType <VRTK_BasicTeleport>()); headsetCollision = (headsetCollision != null ? headsetCollision : FindObjectOfType <VRTK_HeadsetCollision>()); positionRewind = (positionRewind != null ? positionRewind : FindObjectOfType <VRTK_PositionRewind>()); VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this); }
private void InitTeleportListener(bool state) { // Listen for teleport events VRTK_BasicTeleport teleportComponent = GetComponent<VRTK_BasicTeleport>(); if (teleportComponent) { if (state) { teleportComponent.Teleporting += new TeleportEventHandler(OnTeleport); } else { teleportComponent.Teleporting -= new TeleportEventHandler(OnTeleport); } } }
private void Start() { var controllerManager = FindObjectOfType <SteamVR_ControllerManager>(); InitControllerListeners(controllerManager.left); InitControllerListeners(controllerManager.right); // Listen for teleport events VRTK_BasicTeleport teleportComponent = GetComponent <VRTK_BasicTeleport>(); if (teleportComponent) { teleportComponent.Teleporting += new TeleportEventHandler(OnTeleport); } // Required Component: VRTK_PlayerPresence playerPresence = GetComponent <VRTK_PlayerPresence>(); if (useGravity) { if (!playerPresence) { playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>(); } playerPresence.SetFallingPhysicsOnlyParams(true); } // Required Component: VRTK_HeadsetCollisionFade var headCamera = VRTK_DeviceFinder.HeadsetTransform(); var collisionFade = headCamera.GetComponent <VRTK_HeadsetCollisionFade>(); if (collisionFade == null) { collisionFade = headCamera.gameObject.AddComponent <VRTK_HeadsetCollisionFade>(); } collisionFade.HeadsetCollisionDetect += new HeadsetCollisionEventHandler(OnHeadsetCollisionDetected); collisionFade.HeadsetCollisionEnded += new HeadsetCollisionEventHandler(OnHeadsetCollisionEnded); }
protected virtual void OnEnable() { basicTeleport = GetComponent<VRTK_BasicTeleport>(); StartCoroutine(EnableAtEndOfFrame()); }
private void OnEnable() { basicTeleport = GetComponent<VRTK_BasicTeleport>(); StartCoroutine(EnableAtEndOfFrame()); }
private void OnEnable() { basicTeleport = GetComponent <VRTK_BasicTeleport>(); StartCoroutine(EnableAtEndOfFrame()); }
protected virtual void OnEnable() { teleporter = (teleporter != null ? teleporter : FindObjectOfType <VRTK_BasicTeleport>()); enableAtEndOfFrameRoutine = StartCoroutine(EnableAtEndOfFrame()); }