a) 登陆Vuforia官网下载相关资料

b) 选择Download for Unity,注意下载需要登陆账号
选择Downloads-Samples- Digital Eyewear-Download for Unity下载

c) 新建一个Unity项目,导入刚下载的vuforia-unity-6-2-6.unitypackage和hololens-6-2-6压缩文件下的资源包。导入方法Assets 右键> Import Package > Custom Package。
d) 在Project面板下,选择Scenes文件夹,,打开Vuforia-2-Hololens场景文件。运行场景。

e) 提示添加Vuforia App key.此时场景中有两个Camera,一个是hololensCamera,一个ARCamera。
f) 设置ARCamera,选择ARCamera—Vuforia Behaviour --- Open Vuforia configuration。添加App License Key。

g) 注册码到上图获取。
h) 对比下图查看各属性设置是否正确。

i) 注意设置Eyewear type--->Optical see-through ;
Central Anchor Point ----->HololensCamera(将Hierarchy面板下的Hololenscamera拖入)

j) 运行出现上图表示运行成功。否则检查以上步骤是否有遗漏。
k) 发布
【1】在Edit->projectsettings->player->other settings设置下将如下内容勾选上。
【2】在Edit->projectsettings->player->publishing settings设置下将如下内容勾选上。
• InternetClient
• WebCam
• SpatialPerception - if you intend to use the Surface Observer API
导出时选择WindowsStore平台。
接下来可以发布到你的Hololens上测试其效果。
注意笔者在实际的测试中,发现官方的自带这个例子发布到Hololens中会出现模型在识别图下的情况,且在Unity中调整模型在是ImageTarget中的相对位置不能解决。
最后使用上传Width 300。
调整IamgeTarget—ImageTargetBehaviour---width为0.2解决。
网友评论