//------------------------------------------------- void Awake() { allowTeleport = GetComponent <AllowTeleportWhileAttachedToHand>(); allowTeleport.teleportAllowed = true; allowTeleport.overrideHoverLock = false; arrowList = new List <GameObject>(); }
//------------------------------------------------- private void ShowPointer(NVRHand newPointerHand, NVRHand oldPointerHand) { if (!visible) { pointedAtTeleportMarker = null; pointerShowStartTime = Time.time; visible = true; meshFading = true; teleportPointerObject.SetActive(false); teleportArc.Show(); foreach (TeleportMarkerBase teleportMarker in teleportMarkers) { if (teleportMarker.markerActive && teleportMarker.ShouldActivate(player.feetPositionGuess)) { teleportMarker.gameObject.SetActive(true); teleportMarker.Highlight(false); } } //NVRReplace//startingFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess; startingFeetOffset = player.transform.position - player.feetPositionGuess; movedFeetFarEnough = false; if (onDeactivateObjectTransform.gameObject.activeSelf) { onDeactivateObjectTransform.gameObject.SetActive(false); } onActivateObjectTransform.gameObject.SetActive(true); loopingAudioSource.clip = pointerLoopSound; loopingAudioSource.loop = true; loopingAudioSource.Play(); loopingAudioSource.volume = 0.0f; } if (oldPointerHand) { //NVRReplace Debug.LogWarning("Skipping ShouldOverrideHoverLock() on Teleportation - oldPointerHand"); /* * if ( ShouldOverrideHoverLock() ) * { * //Restore the original hovering interactable on the hand * if ( originalHoverLockState == true ) * { * oldPointerHand.HoverLock( originalHoveringInteractable ); * } * else * { * oldPointerHand.HoverUnlock( null ); * } * } */ } pointerHand = newPointerHand; if (visible && oldPointerHand != pointerHand) { PlayAudioClip(pointerAudioSource, pointerStartSound); } if (pointerHand) { pointerStartTransform = GetPointerStartTransform(pointerHand); //NVRReplace //if ( pointerHand.currentAttachedObject != null ) if (pointerHand.CurrentlyInteracting != null) { //NVRReplace//allowTeleportWhileAttached = pointerHand.currentAttachedObject.GetComponent<AllowTeleportWhileAttachedToHand>(); allowTeleportWhileAttached = pointerHand.CurrentlyInteracting.GetComponent <AllowTeleportWhileAttachedToHand>(); } //NVRReplace //Keep track of any existing hovering interactable on the hand /* * originalHoverLockState = pointerHand.hoverLocked; * originalHoveringInteractable = pointerHand.hoveringInteractable; * * if ( ShouldOverrideHoverLock() ) * { * pointerHand.HoverLock( null ); * } */ pointerAudioSource.transform.SetParent(pointerStartTransform); pointerAudioSource.transform.localPosition = Vector3.zero; loopingAudioSource.transform.SetParent(pointerStartTransform); loopingAudioSource.transform.localPosition = Vector3.zero; } }
//------------------------------------------------- public bool IsEligibleForTeleport(NVRHand hand) { if (hand == null) { return(false); } if (!hand.gameObject.activeInHierarchy) { return(false); } //NVRReplace//if ( hand.hoveringInteractable != null ) if (hand.IsHovering) { return(false); } //NVRReplace /* if ( hand.noSteamVRFallbackCamera == null ) * { * if ( hand.controller == null ) * { * return false; * } * * //Something is attached to the hand * if ( hand.currentAttachedObject != null ) * { * AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent<AllowTeleportWhileAttachedToHand>(); * * if ( allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true ) * { * return true; * } * else * { * return false; * } * } * } */ //if ( hand.noSteamVRFallbackCamera == null ) //{ if (hand == null) { return(false); } //Something is attached to the hand if (hand.IsInteracting) { AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.CurrentlyInteracting.GetComponent <AllowTeleportWhileAttachedToHand>(); if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true) { return(true); } else { return(false); } } //} return(true); }