本帖最后由 geekli 于 2017-4-11 15:53 编辑 AR开发者交流群:605785368 AR开发者社区: 第一部分:开发要求 Hololens 运行与Win10,应用程序是与UWP(通用windows开发平台)构建的,开发Hololens 这样的全息体验对电脑的配置要求也是相当高的。 硬件配置: 1.64位Windows 10专业版,企业版或教育版(家庭版不支持Hyper-V) 2.64位CPU 3.8GB以上的RAM 4.在BIOS中,必须具备以下功能:
5.对于GPU,需DirectX 11.0或更高版本,WDDM 1.2驱动程序或更高版本 关于Hyper-V,它是微软的一款虚拟化产品,采用类似Vmware和Citrix开源Xen一样的基于hypervisor的技术。 第二部分:安装 1.启用虚拟化,即在PC上启用硬件虚拟化。
详细步骤请看:https://msdn.microsoft.com/library/windows/apps/jj863509(v=vs.105).aspx
2.启用Hyper-V
3.安装Visual Studio 2017或Visual Studio 2015 Update3(https://developer.microsoft.com/en-us/windows/downloads) 4.安装HoloLens emulator(https://developer.microsoft.com/en-us/windows/mixed-reality/hololens_emulator_archive)
5.安装Unity (https://.com/cn/get-unity/download) 第三部分:关于Hololens 模拟器 HoloLens模拟器允许你在没有Hololens的情况下在PC上测试全息应用程序,并附带Hololens开发工具集。仿真器使用Hyper-V虚拟机。 关于输入:
关于工具栏: 在主窗口的右侧,您将找到仿真器工具栏。工具栏包含以下按钮:
第四部分:开发----Hello,HoloLens!首先我们在unity中新建一个项目,接着添加一个简单的3D模型进行测试,比如:接着部署Windows Store接着,点击Build,生成VS项目:启动VS: 一般默认情况下,从Unity导出的UWP应用程序在任何Windows 10设备上运行。由于HoloLens是不同的,应用程序应该利用仅在HoloLens上可用的功能。为此,您需要在Visual Studio TargetDeviceFamily中的Package.appxmanifest文件中设置为“Windows.Holographic” ,如下: 接下来,就可以运行啦: 第五部分:输入事件总结1.GAZE凝视操作在Hololens中,使用的是用户的头部位置与方向来gaze,而不是眼睛。示例代码(PS:核心在于RayCast): [C#] 纯文本查看 复制代码
[C#] 纯文本查看 复制代码
3.语音输入using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Windows.Speech;
public class SpeechManager : MonoBehaviour { KeywordRecognizer keywordRecognizer = null; Dictionary<string, System.Action> keywords = new Dictionary<string, System.Action>();
// Use this for initialization void Start() { keywords.Add("Reset world", () => { // Call the OnReset method on every descendant object. this.BroadcastMessage("OnReset"); });
keywords.Add("Drop Object", () => { var focusObject = GazeGestureManager.Instance.FocusedObject; if (focusObject != null) { // Call the OnDrop method on just the focused object. focusObject.SendMessage("OnDrop"); } });
// Tell the KeywordRecognizer about our keywords. keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());
// Register a callback for the KeywordRecognizer and start recognizing! keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; keywordRecognizer.Start(); }
private void KeywordRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args) { System.Action keywordAction; if (keywords.TryGetValue(args.text, out keywordAction)) { keywordAction.Invoke(); } } } 4.音频输入 |