diff --git a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/DeviceInfo.cs b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/DeviceInfo.cs index 7cbf9d5367c..02440518a00 100644 --- a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/DeviceInfo.cs +++ b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/DeviceInfo.cs @@ -70,6 +70,7 @@ public class DeviceInfo /// The last known battery state of the device. /// public BatteryInfo BatteryInfo { get; set; } + public ThermalInfo ThermalInfo { get; set; } /// /// The last known power state of the device. diff --git a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs new file mode 100644 index 00000000000..4090f66d670 --- /dev/null +++ b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; + +namespace Microsoft.MixedReality.Toolkit.WindowsDevicePortal +{ + [Serializable] + public class ThermalInfo + { + /// + /// (0 normal, 1 warm, 2 critical) + /// + public int CurrentStage; + } +} \ No newline at end of file diff --git a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs.meta b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs.meta new file mode 100644 index 00000000000..a21cd60c44d --- /dev/null +++ b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DataStructures/ThermalInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 311c8bb8e578dfe4cad4e3b21944a06d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DevicePortal.cs b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DevicePortal.cs index 5b9e14924e8..23b16bcf66f 100644 --- a/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DevicePortal.cs +++ b/Assets/MRTK/Core/Utilities/WindowsDevicePortal/DevicePortal.cs @@ -69,6 +69,7 @@ private static CertificateHandler DevicePortalCertificateHandler private const string GetMachineNameQuery = @"{0}/api/os/machinename"; private const string GetBatteryQuery = @"{0}/api/power/battery"; private const string GetPowerStateQuery = @"{0}/api/power/state"; + private const string GetThermalStateQuery = @"{0}/api/holographic/thermal/stage"; private const string RestartDeviceQuery = @"{0}/api/control/restart"; private const string ShutdownDeviceQuery = @"{0}/api/control/shutdown"; private const string ProcessQuery = @"{0}/api/resourcemanager/processes"; @@ -168,7 +169,32 @@ public static async Task GetBatteryStateAsync(DeviceInfo targetDevi return JsonUtility.FromJson(response.ResponseBody); } + /// + /// Gets the of the target device. + /// + /// + public static async Task GetThermalStateAsync(DeviceInfo targetDevice) + { + var isAuth = await EnsureAuthenticationAsync(targetDevice); + if (!isAuth) { return null; } + + string query = string.Format(GetThermalStateQuery, FinalizeUrl(targetDevice.IP)); + var response = await RestHelpers.Rest.GetAsync(query, targetDevice.Authorization, readResponseData: true, certificateHandler: DevicePortalCertificateHandler, disposeCertificateHandlerOnDispose: false); + + if (!response.Successful) + { + if (response.ResponseCode == 403 && await RefreshCsrfTokenAsync(targetDevice)) + { + return await GetThermalStateAsync(targetDevice); + } + + Debug.LogError(response.ResponseBody); + return null; + } + return JsonUtility.FromJson(response.ResponseBody); + } + /// /// Gets the of the target device. /// @@ -560,10 +586,15 @@ public static async Task UninstallAppAsync(string packageName, DeviceInfo public static async Task LaunchAppAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null) { Debug.Assert(!string.IsNullOrEmpty(packageName)); - + bool isAuth = false; if (appInfo == null) { appInfo = await GetApplicationInfoAsync(packageName, targetDevice); + if (appInfo != null) isAuth = true; + } + else + { + isAuth = await EnsureAuthenticationAsync(targetDevice); } if (appInfo == null) @@ -571,8 +602,14 @@ public static async Task LaunchAppAsync(string packageName, DeviceInfo tar Debug.LogWarning($"Application '{packageName}' not found"); return false; } - string query = $"{string.Format(AppQuery, FinalizeUrl(targetDevice.IP))}?appid={UnityWebRequest.EscapeURL(appInfo.PackageRelativeId.EncodeTo64())}&package={UnityWebRequest.EscapeURL(appInfo.PackageFullName)}"; + if(!targetDevice.Authorization.ContainsKey("cookie")) + { + targetDevice.Authorization.Clear(); + isAuth = await EnsureAuthenticationAsync(targetDevice); + } + + var response = await RestHelpers.Rest.PostAsync(query, targetDevice.Authorization, readResponseData: true, certificateHandler: DevicePortalCertificateHandler, disposeCertificateHandlerOnDispose: false); if (!response.Successful) @@ -603,9 +640,15 @@ public static async Task StopAppAsync(string packageName, DeviceInfo targe { Debug.Assert(!string.IsNullOrEmpty(packageName)); + bool isAuth = false; if (appInfo == null) { appInfo = await GetApplicationInfoAsync(packageName, targetDevice); + if (appInfo != null) isAuth = true; + } + else + { + isAuth = await EnsureAuthenticationAsync(targetDevice); } if (appInfo == null) @@ -615,6 +658,11 @@ public static async Task StopAppAsync(string packageName, DeviceInfo targe } string query = $"{string.Format(AppQuery, FinalizeUrl(targetDevice.IP))}?package={UnityWebRequest.EscapeURL(appInfo.PackageFullName.EncodeTo64())}"; + if (!targetDevice.Authorization.ContainsKey("cookie")) + { + targetDevice.Authorization.Clear(); + isAuth = await EnsureAuthenticationAsync(targetDevice); + } Response response = await RestHelpers.Rest.DeleteAsync(query, targetDevice.Authorization, readResponseData: true, certificateHandler: DevicePortalCertificateHandler, disposeCertificateHandlerOnDispose: false); if (!response.Successful) diff --git a/Documentation/CrossPlatform/OculusQuestMRTK.md b/Documentation/CrossPlatform/OculusQuestMRTK.md index 1f3080b04cc..574d4c30922 100644 --- a/Documentation/CrossPlatform/OculusQuestMRTK.md +++ b/Documentation/CrossPlatform/OculusQuestMRTK.md @@ -9,7 +9,7 @@ The [Unity's XR Pipeline](https://docs.unity3d.com/Manual/XR.html) enables the u This pipeline is the standard for developing XR applications in Unity 2019.3 and beyond. To use this pipeline, make sure that you using **Unity 2019.3 or newer**. The [Oculus Integration Unity package](https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022) allows for the use of **hand tracking** with the Oculus Quest. -This data provider does **NOT** use Unity's **XR Pipeline** or **Legacy XR Pipeline**, but because controllers and headtracking are handeled by the Unity's XR Pipeline, the steps in +This data provider does **NOT** use Unity's **XR Pipeline** or **Legacy XR Pipeline**, but because controllers and headtracking are handled by the Unity's XR Pipeline, the steps in **Setting up project for the Oculus Quest** must be followed to ensure that you are using the **XR Pipeline** and not the to-be-deprecated **Legacy XR Pipeline**. diff --git a/Documentation/Images/MRTK_ConfigureScene.png b/Documentation/Images/MRTK_ConfigureScene.png index c74f5443b04..afa603cd316 100644 Binary files a/Documentation/Images/MRTK_ConfigureScene.png and b/Documentation/Images/MRTK_ConfigureScene.png differ diff --git a/Documentation/Images/MRTK_SceneSetup.png b/Documentation/Images/MRTK_SceneSetup.png index 00976a75b1d..a2577e94c0a 100644 Binary files a/Documentation/Images/MRTK_SceneSetup.png and b/Documentation/Images/MRTK_SceneSetup.png differ diff --git a/Documentation/Images/MRTK_UnitySetupPrompt.png b/Documentation/Images/MRTK_UnitySetupPrompt.png index 8b50c6908d9..eb81b3e47d7 100644 Binary files a/Documentation/Images/MRTK_UnitySetupPrompt.png and b/Documentation/Images/MRTK_UnitySetupPrompt.png differ diff --git a/Documentation/Images/getting_started/MRTK_GettingStarted_TMPro.png b/Documentation/Images/getting_started/MRTK_GettingStarted_TMPro.png index aced6baf8bd..3834cebacb2 100644 Binary files a/Documentation/Images/getting_started/MRTK_GettingStarted_TMPro.png and b/Documentation/Images/getting_started/MRTK_GettingStarted_TMPro.png differ diff --git a/Documentation/Images/getting_started/SwitchPlatform.png b/Documentation/Images/getting_started/SwitchPlatform.png index d251b0a4955..2c9508b4e34 100644 Binary files a/Documentation/Images/getting_started/SwitchPlatform.png and b/Documentation/Images/getting_started/SwitchPlatform.png differ diff --git a/Documentation/Installation.md b/Documentation/Installation.md index f481ec6e3b9..a74f67b49ca 100644 --- a/Documentation/Installation.md +++ b/Documentation/Installation.md @@ -35,19 +35,19 @@ To get started with the Mixed Reality Toolkit, you will need: ### Required -1. [Get the latest MRTK Unity packages](#get-the-latest-mrtk-unity-packages) -1. [Import MRTK packages into your Unity project](#import-mrtk-packages-into-your-unity-project) -1. [Switch your Unity project to the target platform](#switch-your-unity-project-to-the-target-platform) -1. [Add MRTK to a new scene or new project](#add-mrtk-to-a-new-scene-or-new-project) +1. [Get the latest MRTK Unity packages](#1-get-the-latest-mrtk-unity-packages) +1. [Import MRTK packages into your Unity project](#2-import-mrtk-packages-into-your-unity-project) +1. [Switch your Unity project to the target platform](#3-switch-your-unity-project-to-the-target-platform) +1. [Add and configure MRTK with a new scene](#4-add-and-configure-mrtk-with-a-new-scene) ### Optional +* [Run the HandInteractionExamples scene in the Unity Editor](#run-the-handinteractionexamples-scene-in-the-unity-editor) * [Getting started tutorials](#getting-started-tutorials) -* [XR SDK getting started guide (Unity 2019.3 or later)](GettingStartedWithMRTKAndXRSDK.md). * [Learn about the core building blocks of MRTK](#learn-about-the-core-building-blocks-of-mrtk) -* [Run the HandInteractionExamples scene in the Unity Editor](#run-the-handinteractionexamples-scene-in-the-unity-editor) +* [XR SDK getting started guide (Unity 2019.3 or later)](GettingStartedWithMRTKAndXRSDK.md). -### Get the latest MRTK Unity packages +### 1. Get the latest MRTK Unity packages 1. Go to the MRTK release page. 1. Under Assets, download: @@ -59,7 +59,7 @@ To get started with the Mixed Reality Toolkit, you will need: For details on the packages and their contents, please see [MRTK Packages](Packaging/MRTK_Packages.md). -### Import MRTK packages into your Unity project +### 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. 1. 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". @@ -74,7 +74,7 @@ For details on the packages and their contents, please see [MRTK Packages](Packa > Android and iOS development require additional package installations. For more information, see [How to configure MRTK for iOS and Android](CrossPlatform/UsingARFoundation.md). After importing the Foundation package, you may see a prompt similar to the following: -![UnitySetupPrompt](../Documentation/Images/MRTK_UnitySetupPrompt.png) + MRTK is attempting to set up your project for building Mixed Reality solutions by doing the following: @@ -85,7 +85,7 @@ 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**. -### Switch your Unity project to the target platform +### 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. @@ -95,20 +95,20 @@ To create a **HoloLens application**, switch to the Universal Windows Platform: 1. Select **Universal Windows Platform** in the **Platform** list 1. Click the **Switch Platform** button -![Switch Platform](../Documentation/Images/getting_started/SwitchPlatform.png) + >[!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. -### Add MRTK to a new scene or new project +### 4. Add and configure MRTK with a new scene 1. Create a new Unity project, or start a new scene in your current project. -1. Make sure you have imported the MRTK packages (we recommend both Foundation and Examples, though Examples is not required) following [the steps above](#import-mrtk-packages-into-your-unity-project). +1. Make sure you have imported the MRTK packages (we recommend both Foundation and Examples, though Examples is not required) following [the steps above](#2-import-mrtk-packages-into-your-unity-project). 1. From the menu bar, select Mixed Reality Toolkit -> Add to Scene and Configure - ![Configure to scene](../Documentation/Images/MRTK_ConfigureScene.png) + 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](Profiles/Profiles.md) article. @@ -120,8 +120,7 @@ To create a **HoloLens application**, switch to the Universal Windows Platform: > * See the [profiles](Profiles/Profiles.md#hololens-2-profile) for more information on the differences between DefaultMixedRealityToolkitConfigurationProfile and DefaultHoloLens2ConfigurationProfile. You will then see the following in your Scene hierarchy: - - ![MRTK Scene Setup](../Documentation/Images/MRTK_SceneSetup.png) + Which contains the following: @@ -138,37 +137,31 @@ To create a **HoloLens application**, switch to the Universal Windows Platform: > > Further discussion of AR/VR camera rigs can be found in [Unity's documentation](https://docs.unity3d.com/Packages/com.unity.xr.legacyinputhelpers@2.1/manual/index.html#xr-rig-explanation) and elsewhere. -1. Press Play and test out hand simulation by pressing the **spacebar**. +1. **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](BuildAndDeploy.md). - -### Getting started tutorials - -If you are new to MRTK, or MR development, we recommend you check out the [Getting started tutorials](https://docs.microsoft.com/windows/mixed-reality/mrlearning-base) 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)](https://docs.microsoft.com/windows/mixed-reality/mrtk-101) to learn about core building blocks. +You are now ready to build and deploy to device! Follow the steps instructions at [Build and Deploy MRTK](BuildAndDeploy.md). -### Run the HandInteractionExamples scene in the Unity Editor +## Run the HandInteractionExamples scene in the Unity Editor -The [hand interaction examples scene](README_HandInteractionExamples.md) article is a great place to learn more about the UX controls and interactions in MRTK. +The Hand Interaction Examples scene is a great place to experience core spatial interactions and UX controls. [![HandInteractionExample scene](../Documentation/Images/MRTK_Examples.png)](README_HandInteractionExamples.md) -To try the hand interaction scene, do the following steps. +To try the scene, do the following steps. +1. Make sure to import **Microsoft.MixedRealityToolkit.Unity.Examples.unitypackage** package into your project. 1. Open the **HandInteractionExamples** scene under `Assets/MRTK/Examples/Demos/HandTracking/Scenes/HandInteractionExamples` 1. You may get a prompt asking you to import "TMP Essentials". - ![TMP Essentials](../Documentation/Images/getting_started/MRTK_GettingStarted_TMPro.png) + 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](https://docs.microsoft.com/windows/mixed-reality/text-in-unity) for more detailed information) 1. 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. -1. Uncheck or shrink the size of the 3d icons under the Gizmos tab in the Scene view to reduce scene clutter +1. 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 ![Gizmos](https://user-images.githubusercontent.com/13754172/80819866-a8aed800-8b8a-11ea-8d7b-a3822fdfc907.png) @@ -178,6 +171,8 @@ To try the hand interaction scene, do the following steps. 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)](InputSimulation/InputSimulationService.md#controller-simulation) or [eyes](EyeTracking/EyeTracking_BasicSetup.md#simulating-eye-tracking-in-the-unity-editor). +**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. @@ -197,13 +192,29 @@ Have fun exploring the scene! You can learn more about the UI controls [in the h 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](https://docs.microsoft.com/en-us/windows/mixed-reality/develop/unity/tutorials/mr-learning-base-01) 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)](https://docs.microsoft.com/windows/mixed-reality/mrtk-101) to learn about core building blocks. + +- Check out MR Dev Day 2020's session video +[Introduction to MRTK](https://channel9.msdn.com/Shows/Docs-Mixed-Reality/Intro-to-MRTK-Unity) + +- Check out MR Dev Day 2020's session video +[MRTK's UX Building Blocks](https://channel9.msdn.com/Shows/Docs-Mixed-Reality/MRTKs-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](https://docs.microsoft.com/windows/mixed-reality/mrtk-101) 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](../README.md#ux-building-blocks). -* Try [MRTK Examples Hub](README_ExampleHub.md) (pre-built app packages are included in the release page for your convenience) +* Try [MRTK Examples Hub](README_ExampleHub.md) and [Designing Holograms](https://www.microsoft.com/en-us/p/designing-holograms/9nxwnjklrzwd) 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](MixedRealityConfigurationGuide.md). * Learn about the [MRTK's Architecture](../Documentation/Architecture/Overview.md) * Learn about the [MRTK's Input System](../Documentation/Input/Overview.md) diff --git a/Documentation/README_BoundsControl.md b/Documentation/README_BoundsControl.md index 2cfcee6874b..0628a784d4d 100644 --- a/Documentation/README_BoundsControl.md +++ b/Documentation/README_BoundsControl.md @@ -121,7 +121,7 @@ The links configuration enables the wireframe feature of bounds control. The fol - **Show wireframe**: controls visibility of the wireframe. ### Proximity effect configuration -Show and hide the handles with animation based on the distance to the hands. It has two-step scaling animation. Defaults are set to Hololens 2 style behavior. +Show and hide the handles with animation based on the distance to the hands. It has two-step scaling animation. Defaults are set to HoloLens 2 style behavior. @@ -139,7 +139,7 @@ Show and hide the handles with animation based on the distance to the hands. It ## Constraint System Bounds control supports using the [constraint manager](README_ConstraintManager.md) to limit or modify translation, rotation or scaling behavior while using bounds control handles. -The property inspector will show all available constraint managers attached to the same game object in a dropwdown with an option to scroll and highlight the selected constraint manager. +The property inspector will show all available constraint managers attached to the same game object in a dropdown with an option to scroll and highlight the selected constraint manager. @@ -257,7 +257,7 @@ rotationHandleConfiguration.ColliderPadding = 0.016f; ### Example: Set minimum, maximum bounds control scale using MinMaxScaleConstraint -To set the minimum and maximum scale, attach a [`MinMaxScaleConstraint`](xref:Microsoft.MixedReality.Toolkit.UI.MinMaxScaleConstraint) to your constrol. As bounds control automatically attaches and activates constraint manager the MinMaxScaleConstraint will be automatically applied to the transformation changes once it's attached and configured. +To set the minimum and maximum scale, attach a [`MinMaxScaleConstraint`](xref:Microsoft.MixedReality.Toolkit.UI.MinMaxScaleConstraint) to your control. As bounds control automatically attaches and activates constraint manager the MinMaxScaleConstraint will be automatically applied to the transformation changes once it's attached and configured. You can also use MinMaxScaleConstraint to set minimum and maximum scale for [`ObjectManipulator`](xref:Microsoft.MixedReality.Toolkit.UI.ObjectManipulator). diff --git a/Documentation/Tools/HolographicRemoting.md b/Documentation/Tools/HolographicRemoting.md index 4578f04ccb4..65dbfdb6c61 100644 --- a/Documentation/Tools/HolographicRemoting.md +++ b/Documentation/Tools/HolographicRemoting.md @@ -110,6 +110,8 @@ In the event that the installation of the DotNetAdapter cannot be performed via 1. Select Install +1. Enable [a required flag](#dotnetwinrt_present-define-written-into-player-settings) + ### Removing HoloLens 2-specific remoting support