当前位置:网站首页>Hololens 2 development 101: create the first hololens 2 Application
Hololens 2 development 101: create the first hololens 2 Application
2022-07-24 06:13:00 【A small EZ】
notes : Source of this tutorial Microsoft official documents
https://docs.microsoft.com/zh-cn/windows/mixed-reality/mrlearning-base
https://docs.microsoft.com/zh-cn/windows/mixed-reality/mrlearning-base-ch1
There are refinements and changes
1. Overview and objectives
This tutorial is for :HoloLens 2
System essentials
• Use and install correctly Tools Configured WINDOWS 10 The computer
• Windows 10 SDK 10.0.18362.0 Or later
• Some basic C# Programming capabilities .
• Enable Developer model Of HoloLens 2 equipment .
2. Initialize the project and the first application
In this tutorial , You will learn about the hybrid reality toolkit (MRTK) Some functions that must be provided , start-up HoloLens 2 The first application of , And deploy it to the device .
The goal is
• by HoloLens Development goes on Unity Set up .
• Import resources and set the scene .
• Spatial grid 、 Visualization of hand grids and frame rate counters .
explain
Create a new Unity project
- start-up Unity.
- choice “New” .

- Enter the project name ( for example “MixedRealityBase”).

- Enter the location to save the project .

- Please make sure that the project is set to “3D” .

- single click “Create Project” .

Configure for Windows Mixed Reality Of Unity project
- go to “File > Build Settings”, open “Build Settings” window .

- By choice "Universal Windows Platform" Switch to general Windows platform . single click “Switch Platform” Button switch platform . stay HoloLens 2 Applications running on need to be generic Windows platform (UWP) compatible .

- By clicking " Build" Window “Player Settings” Enable virtual reality , And then in “Inspector” In the panel “XR Settings” Next enable “Virtual Reality Supported” Check box , As shown in the figure below . Please note that , You may need to “Build Settings” Drag the window out , To see Inspector panel . “Virtual Reality Supported” The check box also applies to mixed reality and augmented reality head displays , Because it refers to enabling stereoscopic effects ( Each eye presents a different image ).

- In the same Inspector The palette , Make sure that the “Publishing Settings” Next enable “Capabilities” In section “Spatial Perception” Check box . Spatial awareness enables us to work on hybrid reality devices ( Such as HoloLens 2) Visually display the spatial mapping grid . Publishing settings are located at “Inspector” In the panel “XR Settings” and “Other Settings” In the middle of the .

Be careful : Although this tutorial does not use , But you may want to enable others Including the microphone ( For voice commands ) as well as InternetClient( For connecting to services that require a network connection ) Common features of .
Import the mixed reality toolkit (MRTK)
- download MRTK Unity package, And save it to a folder on your computer .
- By clicking ”Assets”>“Import”>“Custom Package” Import the mixed reality toolkit . Find the downloaded hybrid reality toolkit and open it to start the import process . The import process takes a few minutes .


- In the next pop-up window , single click “Import” To start importing the hybrid reality toolkit . Make sure all items are selected , As shown in the figure . If you see a pop-up dialog , It is required to apply the default settings of the hybrid reality toolkit , Please click on the “ application ”.


Configure the hybrid reality toolkit
By selecting “Mixed Reality Toolkit” > “Configure” To configure the MRTK. If you don't see this menu item after importing the hybrid reality toolkit , Please restart. Unity.

[ Be careful ]: You may see a pop-up dialog box , Requirements for The hybrid reality toolkit selects a profile . If it is , Please select “ determine ”, Then choose the name “DefaultMixedRealityToolkitConfigurationProfile” Configuration file for .Your scene will be MRTK There are many new items and modifications in . single click “File” > “Save As”, Save the scene under another name , And assign a name to the scene , for example BaseScene. By saving the scene to the “Assets” In the folder “Scenes” Folder , Keep the scene in order .


Building applications on devicesIf you close “Build Settings” window , Please go to “ file > Build Settings”, Reopen “Build Settings” window .

single click “Add Open Scenes” Button , Make sure the scene you want to try is “Build” In the scene in the list .
Press ”Build” Button to start the generation process .

Create a new folder for your application and name it . In the following illustration , Created a containing application named “App” Folder . single click “Select Folder”, Start generating to the newly created folder . After the generation , It can be turned off Unity Medium “Build Settings” window .

[ Be careful ]: If the build fails , Try building or restarting again Unity And generate again . If you see an error , Such as " error :CS0246 = Type or namespace name not found “XX” ( Is there a lack of using Instruction or assembly reference ?). If so , You may need to install Windows 10 SDK (10.0.18362.0)After the build is complete , Open the newly created folder containing the newly generated application file . double-click “MixedRealityBase” Solution or corresponding name ( If you use an alternate name for the project ) In the Visual Studio Open the solution file in .
Be careful : If you follow the naming in the previous steps , Make sure you open the newly created folder ( namely App Folder ), Because there are people with the same name inside and outside the folder .sln file , This will not be confused by the name .
Be careful : If Visual Studio You are required to install new components , Please take a moment to ensure that “ Installation tools ” Install all prerequisites according to the instructions in the pagetake HoloLens 2 Connect to your PC. Although these instructions assume that you want to use HoloLens 2 Equipment deployment test , But you can also choose to deploy to hololens 2 Simulator , Or choose to create an application package for side loading
Before deploying to the device , Please make sure the device is in developer mode . If this is your first deployment to HoloLens 2, be Visual Studio You may be asked to HoloLens 2 And PIN pairing . If you need to enable Developer mode or with Visual Studio pairing , Please follow these instructions .
By choice “ Release ” Configuration and ARM Architecture , take Visual Studio Configured to generate to HoloLens 2.

The last step is to select “ debugging ” > “ Start execution ( Don't debugging )” To generate devices . If you choose “ Start without debugging ”, It will cause the application to start immediately after successful generation , But not in Visual Studio Debugging information is displayed in . This also means that you can HoloLens 2 Disconnect while running the application on USB Connect , Without stopping the application . You have a choice “Build” > Deploy the solution to the device , Without the application starting automatically .

Congratulations on
Now? , You have deployed the first HoloLens 2 Applications . When browsing , You should see a spatial grid , It contains information that has been provided by HoloLens 2 All surfaces detected . Besides , You should see indicators on your hands and fingers for hand tracking , And a frame rate counter for tracking application performance . These are just some of the basic functions that are readily available in the hybrid reality toolkit . In the following tutorial , You start adding more content and interactivity to the scene , So that you can fully explore HoloLens 2 Features and hybrid reality toolkit .
边栏推荐
- 力扣:1-两数之和
- The detailed process of connecting MySQL with QT and outputting data to QT window tablewidget.
- Foundation of JUC concurrent programming (7) -- multithread lock
- QT novice entry level calculator addition, subtraction, multiplication, division, application
- Openpose Unity 插件部署教程
- [raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp
- Dameng database_ Trigger, view, materialized view, sequence, synonym, auto increment, external link and other basic operations
- Learning rate optimization strategy
- JDBC advanced -- learning from Shang Silicon Valley (DAO)
- Unity Shader :实现漫反射与高光反射
猜你喜欢

Positional argument after keyword argument

MySql下载,及安装环境设置

快速简单搭建FTP服务器,并内网穿透实现公网访问【无需公网IP】

公网使用Microsoft Remote Desktop远程桌面,随时远程办公

JDBC进阶—— 师承尚硅谷(DAO)

Learning rate optimization strategy

day6-jvm

Paper reading endmember guided unmixing network (EGU net)

unity2D横版游戏跳跃实时响应

Calculation steps of principal component analysis
随机推荐
PDF Text merge
常见十大漏洞总结(原理、危害、防御)
systemctl + journalctl
JUC并发编程基础(7)--多线程锁
LSTM neural network
Demo of UDP communication applied to various environments
Dameng database_ Logical backup
QT novice entry level calculator addition, subtraction, multiplication, division, application
Unity(三)三维数学和坐标系统
Foundation of JUC concurrent programming (7) -- multithread lock
UE4 reload system 2. Scene capture of reload system
Learning rate optimization strategy
UE4 random generation of items
Accurate calculation of time delay detailed explanation of VxWorks timestamp
Statistical analysis of catering data --- Teddy cloud course homework
Day3 jvm+ sorting summary
Yolov5 learning summary (continuously updated)
Hit the wall record (continuously updated)
JUC并发编程基础(8)--读写锁
Typora installation package in November 2021, the last free version of the installation package to download v13.6.1