MRTK

MRTK works great for UI and remote interactions. You can get the best of physically contrained UI and remote interaction with by using MRTK+HPTK.

However, MRTK has some particularities that you have to know in order to make it work properly:

  • MRTK uses Standard rendering pipeline. HPTK comes out-of-the-box to use URP.

  • MRTK uses collision layers to detect ray targets that may interfere with our collider-full hands.

  • MRTK instantiates the rig on run-time according to the platform but HPTK singleton needs references to the camera and the tracking space origin.

How to use MRTK + HPTK?

For new scenes, add the DefaultSetup prefab that fits your target platform. If the scene does not contain any avatar, add the DefaultAvatar prefab that fits your render pipeline.

More details about initial setup in Setup section.

1. Obtain MRTK

MRTK +2.5 can be managed using the Unity Package Manager (UPM). Follow this documentation to install Mixed Reality features using the UPM.

If you're new to MRTK or Mixed Reality development in Unity, take a look to this guide. This guide is the recommended starting point for MRTK, specifically created to walk you through the installation, core concepts, and usage of MRTK in Unity.

For educational purposes, MRTK-Quest-Sample is a ready-to-go Unity project made by provencher that uses MRTK and Oculus Quest hand tracking.

2. Configure MRTK

Add MicrosoftRealityToolkit singleton to your scene.

Open the MRTK Project Configurator window (Mixed Reality Toolkit > Utilities > Configure Unity Project). Then apply the recommended configuration.

2.1. Integrate Oculus-MRTK (Quest)

From Unity Package Manager, install the Oculus XR Plugin package.

Integrate Oculus Integration Unity modules from Mixed Reality Toolkit > Utilities > Oculus > Integrate Oculus Integration Unity Modules.

3. Collision layers

Configure layer collision matrix in ProjectSettings/Physics:

  1. Create new layer called HPTK.

  2. Make HPTK layer to ignore Default and UI layers.

Use the new collision layer. In HPTK singleton, set HPTK.applyThisLayerToChildren = HPTK

On Start, HPTK will apply that layer to all its children as HPTK singleton is the root object that encapsulates the GameObjects related with HPTK, including the avatar representations.

4. Switch to StandardRP

If you are using the DefaultAvatar.URP prefab, replace it by the DefaultAvatar.Standard prefab variant.

If DefaultAvatar.URP is part of another prefab, unpack its parent prefab first.

5. Remove references to camera and tracking spaces (Quest)

Remove any existing instance of OVRCameraRig as MRTK will instantiate it on start.

In the HPTK singleton set:

  • HPTK.trackedCamera = NULL

  • HPTK.trackingSpace = NULL

For each OVRSkeletonTracker set:

  • OVRSkeletonTracker.ovrHand = NULL

  • OVRSkeletonTracker.ovrSkeleton = NULL

When these values are missing, each OVRSkeletonTracker will search for those values each frame until finding them. They will find it once MRTK instantiates the OVRCameraRig.

6. Import HPTK+MRTK Integration Package

Open the Integration Manager, click on MRTK and import the built-in integration package.

7. Import MRTK-Quest Integration Package (Quest)

Open the Integration Manager, click on 'MRTK Quest' and import the built-in integration package.

This package contains a demo scene with MRTK+HPTK working for Oculus Quest.

MRTK Quest integration package has dependencies with the Oculus integration package. If Oculus integration package is not imported in your project, then open Integration Manager, click on Oculus and import the package.

8. Set the configuration profile

In the Mixed Reality Toolkit singleton, set the profile MRTK-HPTK-ConfigurationProfile.

9. Add an interactive object

In Assets/HPTK/Integrations/MRTK/Prefabs/Interactables you will find some example objects.

These objects exemplify how MRTK remote interactions can be combined with touchable objects and physics-based near interactions.

These objects follow a pattern:

  • Root object:

    • Uses the Default layer.

    • The MRTK-related components are attached to it.

    • Has a BoxCollider component that defines its boundaries.

  • Child object:

    • Uses the HPTK layer (and its child objects).

    • Contains the Colliders that defines the touchable surface.

Last updated