void SendTeleportRequest(XRBaseInteractor interactor) { if (!interactor || m_TeleportationProvider == null) { return; } XRRayInteractor rayInt = interactor as XRRayInteractor; if (rayInt != null) { RaycastHit raycastHit; if (rayInt.GetCurrentRaycastHit(out raycastHit)) { // are we still selecting this object bool found = false; for (int i = 0; i < colliders.Count; i++) { if (colliders[i] == raycastHit.collider) { found = true; break; } } if (found) { TeleportRequest tr = new TeleportRequest(); tr.matchOrientation = m_MatchOrientation; tr.requestTime = Time.time; if (GenerateTeleportRequest(interactor, raycastHit, ref tr)) { m_TeleportationProvider.QueueTeleportRequest(tr); } } } } }
protected override bool GenerateTeleportRequest(XRBaseInteractor interactor, RaycastHit raycastHit, ref TeleportRequest teleportRequest) { teleportRequest.destinationPosition = raycastHit.point; teleportRequest.destinationUpVector = transform.up; // use the area transform for data. teleportRequest.destinationForwardVector = transform.forward; teleportRequest.destinationRotation = transform.rotation; return(true); }
protected virtual bool GenerateTeleportRequest(XRBaseInteractor interactor, RaycastHit raycastHit, ref TeleportRequest teleportRequest) { return(false); }
/// <summary> /// This function will queue a teleportation request within the provider. /// </summary> /// <param name="teleportRequest">The teleportation request to queue.</param> /// <returns>Returns <see langword="true"/> if successfully queued. Otherwise, returns <see langword="false"/>.</returns> public virtual bool QueueTeleportRequest(TeleportRequest teleportRequest) { currentRequest = teleportRequest; validRequest = true; return(true); }
protected override bool GenerateTeleportRequest(XRBaseInteractor interactor, RaycastHit raycastHit, ref TeleportRequest teleportRequest) { if (teleportAnchorTransform == null) { return(false); } teleportRequest.destinationPosition = m_TeleportAnchorTransform.position; teleportRequest.destinationUpVector = m_TeleportAnchorTransform.up; teleportRequest.destinationRotation = m_TeleportAnchorTransform.rotation; teleportRequest.destinationForwardVector = m_TeleportAnchorTransform.forward; return(true); }
/// <summary> /// This function will queue a teleportation request within the provider. /// </summary> /// <param name="teleportRequest">The teleportation request</param> /// <returns>true if successful.</returns> public bool QueueTeleportRequest(TeleportRequest teleportRequest) { m_CurrentRequest = teleportRequest; m_ValidRequest = true; return(true); }