Mrtk Github



MRTK is developed in Unity. I used here the example scene Hand Interaction. I compiled it into WebGL with Unity, so I got javascript (as WebAssembly). Since Safari is not yet compatible with WebXR under iOS (I don’t have an Android phone), I had to use the XRViewer browser developed by Mozilla. However, the implementation of WebXR is not standard because it was a test application. See how it works on GitHub: https://github.com/Rufus31415/Simple-WebXR-Unityhttps://github.com/Rufus31415/Simple-WebXR-Unity.

  1. Mrtk Download
  2. Microsoft Github Mrtk
  3. Hololens Mrtk Github
  4. Mrtk Hololens 2
Caution

See this page on the new docs website.We've moved so we can provide you with a better docs experience. We will no longer be maintaing documentation on Github.Check out the new site to get started with MRTK in Unity!

Important

If you're new to MRTK or Mixed Reality development in Unity, we recommend you start at the beginning of our Unity development journey. The Unity development journey is the recommended starting point for MRTK, specifically created to walk you through the installation, core concepts, and usage of MRTK in Unity.

Prerequisites

To get started with the Mixed Reality Toolkit, you will need:

  • MRTK supports both IL2CPP and .NET scripting backends on Unity 2018.
    Starting from MRTK 2.5 Unity 2018.4.13f1 or later is strongly recommended for customers using Unity 2018. Earlier versions of Unity 2018.4 are still supported but now require extra steps to set up and to upgrade to Unity 2019.

  • Windows SDK 18362+.

    This is necessary if you are building a UWP app for WMR, HoloLens 1, or HoloLens 2. This is not necessarywhen building for OpenVR.

Add MRTK to your Unity project

Note

Users of Unity 2019.4 and newer, can use the Unity Package Manager to import MRTK. Please see Using the Unity Package Manager for more information.

Required

Optional

  • XR SDK getting started guide (Unity 2019.3 or later).

1. Get the latest MRTK Unity packages

  1. Go to the MRTK release page.
  2. Under Assets, download:
    • Microsoft.MixedRealityToolkit.Unity.Foundation.unitypackage
    • (Optional) Microsoft.MixedRealityToolkit.Unity.Extensions.unitypackage
    • (Optional) Microsoft.MixedRealityToolkit.Unity.Examples.unitypackage
    • (Optional) Microsoft.MixedRealityToolkit.Unity.TestUtilities.unitypackage
    • (Required for version-to-version upgrades, Optional otherwise) Microsoft.MixedRealityToolkit.Unity.Tools.unitypackage
Mrtk Github

For details on the packages and their contents, please see MRTK Packages.

2. Import MRTK packages into your Unity project

  1. Create a new Unity project, or open an existing project. When creating a project, make sure to select '3D' as the template type.
  2. Import the Microsoft.MixedRealityToolkit.Unity.Foundation.unitypackage you downloaded by going into 'Asset -> Import Package -> Custom Package', select the .unitypackage file, ensure all items to import are checked, and then select 'Import'.
  3. (Optional) Import the Microsoft.MixedRealityToolkit.Unity.Extensions.unitypackage following the same steps as the foundation package. The extensions package provides a set of useful optional components for the MRTK.
  4. (Optional) Import the Microsoft.MixedRealityToolkit.Unity.Examples.unitypackage following the same steps as above. The examples package is optional and contains useful demonstration scenes for current MRTK features. Note that the Examples package requires the Extensions package.
  5. (Required for version-to-version upgrades, Optional otherwise) Import the Microsoft.MixedRealityToolkit.Unity.Tools.unitypackage following the same steps as the foundation package. The tools package is optional and contains useful tools, such as the ExtensionServiceCreator, that enhance the MRTK developer experience.
Note

If you are using Unity 2018.4.12f1 or earlier, note you will experience compilation errors shown in the console. Go to AssetsMRTKProvidersXRSDKMicrosoft.MixedReality.Toolkit.Providers.XRSDK.asmdef in the project window and remove the missing reference in the inspector. Repeat those steps with AssetsMRTKProvidersOculusXRSDKMicrosoft.MixedReality.Toolkit.Providers.XRSDK.Oculus.asmdef and AssetsMRTKProvidersWindowsMixedRealityXRSDKMicrosoft.MixedReality.Toolkit.Providers.XRSDK.WMR.asmdef. Note you must revert the changes by replacing those three asmdef files with original (i.e. unmodified) ones when upgrading to Unity 2019.

Note

Android and iOS development require additional package installations. For more information, see How to configure MRTK for iOS and Android.After importing the Foundation package, you may see a prompt similar to the following:

MRTK is attempting to set up your project for building Mixed Reality solutions by doing the following:

  • Enable XR Settings for your current platform (enabling the XR checkbox).
  • Force Text Serialization / Visible Meta files (recommended for Unity projects using source control).

Accepting these options is completely optional, but recommended.

Some prefabs and assets require TextMesh Pro, meaning you need the TextMesh Pro package installed and the assets in your project (Window -> TextMeshPro -> Import TMP Essential Resources). After you import TMP Essentials Resources, you need to restart Unity to see changes.

3. Switch your Unity project to the target platform

With the packages imported, the next step is to select the correct platform for the application.

To create a HoloLens application, switch to the Universal Windows Platform:

  1. Open menu : File > Build Settings

  2. Select Universal Windows Platform in the Platform list

  3. Click the Switch Platform button

Github
Note

The Mixed Reality Toolkit will prompt to apply recommended changes to the project when the platform is selected. Whenever the platform is switched, the appropriate settings will be checked and prompted, if necessary.

4. Add and configure MRTK with a new scene

  1. Create a new Unity project, or start a new scene in your current project.

  2. Make sure you have imported the MRTK packages (we recommend both Foundation and Examples, though Examples is not required) following the steps above.

  3. From the menu bar, select Mixed Reality Toolkit -> Add to Scene and Configure

    The inspector will now show the currently active MRTK configuration profile and the profile selection dropdown, where the default profile is already preselected.Profiles configure the behavior of MRTK core components and are described in more detail in the profiles article.

    Note
    • If you're using Unity's XR SDK in Unity 2019.3 or later, you should choose the 'DefaultXRSDKConfigurationProfile'. This profile is set up with MRTK's XR SDK systems and providers, where needed.
    • If you're getting started on the HoloLens or HoloLens 2, you should choose the 'DefaultHoloLens1ConfigurationProfile' or DefaultHoloLens2ConfigurationProfile' instead.
    • See the profiles for more information on the differences between DefaultMixedRealityToolkitConfigurationProfile and DefaultHoloLens2ConfigurationProfile.

    You will then see the following in your Scene hierarchy:

    Which contains the following:

    • Mixed Reality Toolkit - The toolkit itself, providing the central configuration entry point for the entire framework.
    • MixedRealityPlayspace - The parent object for the headset, which ensures the headset / controllers and other required systems are managed correctly in the scene.
    • The Main Camera is moved as a child to the Playspace - Which allows the playspace to manage the camera in conjunction with the SDKs.
    Note

    While working in your scene, DO NOT move the Main Camera or the MixedRealityPlayspace. These are controlled by the active SDK and the MRTK respectively. Any settings you make to the Main Camera or MixedRealityPlayspace transforms will at best be overwritten, and at worst result in undefined behavior.

    The entire rig, Camera and Playspace, can be moved by adding another GameObject to the scene, and making it the parent of the MixedRealityPlayspace. When that object is moved, the Playspace and Camera will follow loosely behind, subject to the additional local transform changes made by the active SDK and the MRTK.

    Another option is to move the scene contents relative to the camera, although this can become problematic in advanced scenarios incorporating content such as Nav Meshes, terrains, or particle systems.

    Further discussion of AR/VR camera rigs can be found in Unity's documentation and elsewhere.

  4. Press Play and test out hand simulation by pressing the spacebar. You can open the keyboard shorcut reference by pressing CTRL+H key.

You are now ready to build and deploy to device! Follow the steps instructions at Build and Deploy MRTK.

Run the HandInteractionExamples scene in the Unity Editor

The Hand Interaction Examples scene is a great place to experience core spatial interactions and UX controls.

To try the scene, do the following steps.

  1. Make sure to import Microsoft.MixedRealityToolkit.Unity.Examples.unitypackage package into your project.

  2. Open the HandInteractionExamples scene under Assets/MRTK/Examples/Demos/HandTracking/Scenes/HandInteractionExamples

  3. You may get a prompt asking you to import 'TMP Essentials'.

    If you get such a prompt, select the 'Import TMP essentials' button. 'TMP Essentials' refers to Text Mesh Pro plugin, which some of the MRTK examples use for improved text rendering. (See Text in Unity for more detailed information)

  4. Close the TMP dialog. After this you need to reload the scene. You can do this by double-clicking the scene in the Project tab.

  5. Uncheck (Unity 2019 or higher) or shrink the size of the 3d icons using the slider (Unity 2018) under the Gizmos tab in the Scene view to reduce scene clutter

  6. Press the Play button.

Using the in-editor hand input simulation to test a scene

The in-editor input simulation allows you to test virtual object behavior given a specific type of input such as controllers (i.e. hands, motion controllers) or eyes.

Mrtk Download

You can open the keyboard shorcut reference by pressing CTRL+H key.

How to move around in the scene:

  • Use W/A/S/D keys to move the camera forward/left/back/right.
  • Use Q/E to move the camera vertically.
  • Press and hold the right mouse button to rotate the camera.

How to simulate hand input:

  • Press and hold the spacebar to enable the right hand.
  • While holding the space bar, move your mouse to move the hand.
  • Use the mouse scroll wheel to adjust the depth of the hand.
  • Click the left mouse button to simulate pinch gesture.
  • Use T/Y keys to make the hand persistent in the view.
  • Hold CTRL key and move the mouse to rotate the hand.

Have fun exploring the scene! You can learn more about the UI controls in the hand interaction examples guide. Also, read through input simulation docs to learn more about in-editor hand input simulation in MRTK.

Congratulations, you just used your first MRTK scene. Now onto creating your own experiences...

Getting started tutorials

If you are new to MRTK, or MR development, we recommend you check out the Getting started tutorials which uses MRTK v2.

Learn about the core building blocks of MRTK

  • Check out MRTK 101: How to use Mixed Reality Toolkit Unity for Basic Interactions (HoloLens 2, HoloLens, Windows Mixed Reality, Open VR) to learn about core building blocks.

  • Check out MR Dev Day 2020's session videoIntroduction to MRTK

  • Check out MR Dev Day 2020's session videoMRTK's UX Building Blocks

Next steps

Here are some suggested next steps:

  • Check out MRTK 101: How to use Mixed Reality Toolkit Unity for Basic Interactions to learn about how to achieve common spatial interactions such as grab, move, scale, and rotate.

  • Learn about the UX controls available in MRTK in UI and interaction building blocks.

  • Try MRTK Examples Hub and Designing Holograms app which can be downloaded from Microsoft Store app in your HoloLens 2.

  • Learn how to work with the MRTK Configuration profile in the mixed reality configuration guide.

  • Learn about the MRTK's Architecture

  • Learn about the MRTK's Input System

  • Learn about the MRTK's Tools that will empower your mixed reality design and development.

  • Read through input simulation guide to learn how to simulate hand input in editor.

Getting help

If you run into issues caused by MRTK or otherwise have questions about how to do something, there are a few resources that can help:

  • For bug reports, please file an issue on the GitHub repo.
  • For questions, please reach out on either StackOverflow or the mixed-reality-toolkit channel on Slack. You can join the Slack community via the automatic invitation sender.

Upgrading from the HoloToolkit (HTK/MRTK v1)

Microsoft Github Mrtk

There is not a direct upgrade path from the HoloToolkit to Mixed Reality Toolkit v2 due to the rebuilt framework. However, it is possible to import the MRTK into your HoloToolkit project and migrate your implementation. For more information, see the HoloToolkit to Mixed Reality Toolkit Porting Guide

Getting started with Unity's XR SDK

Complete instructions and information can be found in our XR SDK getting started guide.

-->

Che cos'è Mixed Reality Toolkit (MRTK)?What is Mixed Reality Toolkit (MRTK)?

MRTK è uno straordinario toolkit open source disponibile sin dalla prima versione di HoloLens.MRTK is an amazing open-source toolkit that has been around since the HoloLens was first released.Il toolkit non avrebbe raggiunto i livelli attuali senza il contributo e l'impegno costante della community di sviluppatori Microsoft.The toolkit wouldn't be where it is today without the hard work of our contributing developer community.Negli ultimi tre anni abbiamo acquisito feedback dalla community di sviluppatori e abbiamo creato MRTK v2 tenendo conto delle principali esigenze e segnalazioni.Over the past three years, we've listened to the feedback of our developer community, and built MRTK v2 to take the biggest concerns into account.

MRTK per Unity è un kit di sviluppo multipiattaforma open source per applicazioni di realtà mista.MRTK for Unity is an open-source, cross-platform development kit for mixed reality applications.Il modo più semplice per installare il Toolkit è con la nuova applicazione di strumenti per la funzionalità di realtà mista.The easiest way to install the toolkit is with our new Mixed Reality Feature Tool application.Seguire le istruzioni per l'installazione e l'utilizzo e selezionare il pacchetto mixed reality Toolkit Foundation nella categoria Mixed Reality Toolkit.Follow our installation and usage instructions and select the Mixed Reality Toolkit Foundation package in the Mixed Reality Toolkit category.

MRTK per Unity offre un sistema di input multipiattaforma, componenti fondamentali e blocchi predefiniti comuni per le interazioni spaziali.MRTK for Unity provides a cross-platform input system, foundational components, and common building blocks for spatial interactions.MRTK versione 2 intende accelerare lo sviluppo di applicazioni per Microsoft HoloLens, i visori VR immersive di Windows Mixed Reality e la piattaforma OpenVR.MRTK version 2 intends to speed up application development for Microsoft HoloLens, Windows Mixed Reality immersive (VR) headsets, and OpenVR platform.Il progetto mira a ridurre le barriere di accesso, creare applicazioni di realtà mista e restituire contributi alla community per continuare a crescere insieme.The project is aimed at reducing barriers to entry, creating mixed reality applications, and contributing back to the community as we all grow.


Per altri dettagli sulle funzionalità, vedere la documentazione di MRTK su GitHub .Take a look at MRTK's documentation on GitHub for more feature details.

Novità di MRTK v2New with MRTK v2

È importante sottolineare l'impegno che abbiamo dedicato a questi strumenti della piattaforma.We want to stress our commitment to these platform tools.Infatti, abbiamo usato MRTK versione 2 per sviluppare le esperienze integrate, come l'esperienza di installazione predefinita (OOBE) e l'applicazione Mixed Reality Tips.In fact, we used MRTK version 2 to develop our inbox experiences, such as the out-of-box setup experience (OOBE) and our Mixed Reality Tips application.Probabilmente avrai l'occasione anche di vedere nuove funzionalità di HoloLens 2 esposte tramite MRTK prima del rilascio, perché crediamo che questo sia il modo migliore per sviluppare sulla nostra piattaforma.You can also expect to see new HoloLens 2 capabilities first exposed through MRTK because we believe it’s the best way to develop on our platform.

ModularitàModular

Il toolkit è stato creato in modo modulare, quindi non è necessario includerlo per intero nel progetto.We have built it in a modular way, so you don't need to take every bit of the toolkit into your project.Questa caratteristica presenta alcuni vantaggi.There are actually a few benefits to this.Consente di limitare le dimensioni del progetto e ne semplifica la gestione.It keeps your project size smaller, and makes it easier to manage.Inoltre, poiché il toolkit è stato creato con oggetti gestibili tramite script ed è dotato di interfaccia, puoi anche sostituire i componenti inclusi nel toolkit con componenti personalizzati, per supportare altri servizi, sistemi e piattaforme.Additionally, because it’s built with scriptable objects and is interface-driven, it’s also possible for you to replace the components that are included with your own, to support other services, systems, and platforms.

Hololens Mrtk Github

MultipiattaformaCross-platform

Il toolkit include il supporto per più piattaforme.Speaking of other platforms, it has cross-platform support.Anche se questo non significa che ogni singola piattaforma sia supportata, Microsoft ha fatto in modo che nessuna parte di codice del toolkit smetta di funzionare quando si scelgono altre piattaforme di destinazione per la build.And while this doesn’t mean every single platform is supported, we have made sure none of the toolkit code will break when you switch your build target to other platforms.L'affidabilità e l'estendibilità della progettazione modulare permettono alle app di supportare più piattaforme, ad esempio ARCore, ARKit e OpenVR.The robustness and extensibility of the modular design sets your apps up to support multiple platforms, such as ARCore, ARKit, and OpenVR.

Ottime prestazioniPerformant

Mrtk Hololens 2

Dovendo lavorare con piattaforme mobili, abbiamo realizzato il toolkit tenendo sempre ben presenti le prestazioni.Working with mobile platforms, we constructed it with performance in mind.Questo aspetto è molto importante e Microsoft ha voluto assicurarsi che gli strumenti non creino difficoltà agli utenti.This is super important, and we wanted to ensure that the tools aren't going to work against you.

Vedere ancheSee also