Teleport 系統 — MRTK2

Teleport 系統是 MRTK 的子系統,會在應用程式使用不透明顯示器時處理使用者遠端傳送。 對於 HoloLens) 之類的 AR 體驗 (,遠端傳輸系統不會作用中。 針對 (OpenVR 的沉浸式 HMD 體驗,可以啟用 WMR) 遠端傳輸系統。

啟用和停用

透過切換其設定檔中的核取方塊,即可啟用或停用遠端傳輸系統。 您可以藉由選取場景中的 MixedRealityToolkit 物件,按一下 [Teleport],然後切換 [啟用 Teleport 系統] 核取方塊來完成。

這也可以在執行時間完成:

void DisableTeleportSystem()
{
    CoreServices.TeleportSystem.Disable();
}

void EnableTeleportSystem()
{
    CoreServices.TeleportSystem.Enable();
}

事件

Teleport 系統會透過 IMixedRealityTeleportHandler 介面公開事件,以在遠端傳送動作開始、結束或取消時提供訊號。 如需事件機制及其相關承載的詳細資訊,請參閱連結的 API 檔。

使用方式

如何註冊遠端傳送事件

下列程式碼示範如何建立 MonoBehaviour 來接聽遠端傳送事件。 此程式碼假設已啟用遠端傳輸系統。

using Microsoft.MixedReality.Toolkit;
using Microsoft.MixedReality.Toolkit.Teleport;
using UnityEngine;

public class TeleportHandlerExample : MonoBehaviour, IMixedRealityTeleportHandler
{
    public void OnTeleportCanceled(TeleportEventData eventData)
    {
        Debug.Log("Teleport Cancelled");
    }

    public void OnTeleportCompleted(TeleportEventData eventData)
    {
        Debug.Log("Teleport Completed");
    }

    public void OnTeleportRequest(TeleportEventData eventData)
    {
        Debug.Log("Teleport Request");
    }

    public void OnTeleportStarted(TeleportEventData eventData)
    {
        Debug.Log("Teleport Started");
    }

    void OnEnable()
    {
        // This is the critical call that registers this class for events. Without this
        // class's IMixedRealityTeleportHandler interface will not be called.
        CoreServices.TeleportSystem.RegisterHandler<IMixedRealityTeleportHandler>(this);
    }

    void OnDisable()
    {
        // Unregistering when disabled is important, otherwise this class will continue
        // to receive teleportation events.
        CoreServices.TeleportSystem.UnregisterHandler<IMixedRealityTeleportHandler>(this);
    }
}

MRTK 上的 Teleporting

若要在具有預設設定的 MR 裝置上以控制器傳送電話,請使用搖桿。 若要使用已表達的手部進行遠端移植,請利用手部向外貼上索引和拇指,藉由捲動索引手指來完成電匯。 若要使用輸入模擬來傳送電話,請參閱更新的 輸入模擬服務檔

Teleport 筆勢