Unity接入HuaweiAREngine

Unity接入HuaweiAREngine


2023年11月29日发(作者:ipod touch2能玩的游戏)

Unity接⼊HuaweiAREngine

说在前⾯

使⽤Unity进⾏AR开发的开发者基本都会遇到华为⼿机的坎:由于⾕歌的制裁,ARCore并不能覆盖华为的新机型导致新的机型已经不能使⽤

ARFoundation⽅案;使⽤第三⽅通⽤的ARsdk也并不能完美兼容常⽤的华为机型,毕竟官⽅原⽣的sdk才是最适配⾃⾝机型的。最近我也在学习

接⼊HuaweiAREngine与ARFoundation兼容使⽤的项⽬,搜集了⼀些解决⽅案并进⾏了总结,由于unity相关的⽅案官⽅迟迟还没有更新(官⽅

也关闭了旧的2.0版本的下载⼊⼝ ),下⾯提供的sdk版本也是测试版本,仅供学习使⽤。

⼀、简介

Huawei AR Engine 是⼀个在 Android 智能⼿机上构建增强现实应⽤程序的平台。⽬前⽀持的功能包括:

运动跟踪

平⾯检测

光照估计和命中测试

⼿势识别和⾻骼跟踪

WorldAR不⽀持Mate20系列,P20系列,Nova3,麦芒5,荣耀V20系列

BodyAR不启动Mate20系列,P20系列,Nova3,麦芒5,荣耀V20系列

BodyAR启动荣耀V20系列

HandAR不启动Mate20系列,P20系列,Nova3,麦芒5 ,荣耀V20系列

HandAR启动Mate20 Pro

FaceAR启动Mate20 Pro

WorldBodyAR不启动Mate20系列,P20系列,Nova3,麦芒5,荣耀V20系列

WorldBodyAR启动(world不⽀持,body启动)荣耀V20系列

⼆、Huawei AR Engineunitypackage介绍

⽬前华为官⽹上是找不到unity相关的sdk,但⽬前华为论坛上还是存在内测版的Huawei AR Engine的unitypackage,我这边有两个

unitypackage的版本,分别对应不同的unity版本使⽤

其中:

nesdk-sample-unity-2.0.0.5

环境要求:

⼿机EMUI版本9.0以上

在应⽤市场下载并安装AREngine

Unity 2017.4LTS 以上 Unity2019.4LTS以下的版本

nesdk-sample-unity-3.0.0.11

环境要求:

三、SDK的接⼊与使⽤

因为2.0与3.0除了⼀些细节部分外使⽤的流程基本⼀致,所以这⾥就不分开直接⼀起说明。导⼊sdk后,在Example⽂件夹可以查看官⽅提供的所

有demo

每个demo⽂件夹下有对应的功能配置,每个场景都需要加载对应的配置才能正常使⽤, 这⾥只挑⼀个demo作简单介绍。

WorldARSample这个demo主要是演⽰AR模型识别真实环境的地⾯并放置

配置⽂件的属性介绍如下:

/**if english

* Lighting mode of an configuration object. Default value is AMBIENT_INTENSITY

* endif

*/

public ARConfigUpdateMode UpdateMode = NG;

/**if english

* Power mode of an configuration object. Default value is NORMAL

* else

* 配置项的功耗模式。默认不使⽤低功耗。

* endif

/**

* if english

* Set the database of image tracking. Default is null.

/**

* if english

* @brief Request to insatll the HUAWEI AR synchronously.

*

* We recommand you to call this method in

* OnApplictionPause(bool).

* When the application starts, set c userRequestedInstall=true.

* If HUAWEI AR is installed and compatiable, this method will return

* link LEDendlink immediately.

* Otherwise, this function will firstly check current device availability. If the device is supported, this function

* show a window to prompt user. If user agree, it will jump to huawei application store. And then this function returns

* link L_REQUESTEDendlink.

*

* When your application resume, you should call this method again with c userRequestedInstall=false.

* This will either return INSTALLED or throw an exception indicating the reason that installation could not be completed.

* @param userRequestedInstall If set c true, override the previous installation failure message and perform the installation again.

* @return The Install status of HUAWEI AR Engine.

* else

* @brief 同步请求安装HAUWEI AR

*

* 推荐在OnApplictionPause(bool)

* 中调⽤该⽅法。

*

/**

* if english

* @brief Create a new ARSession.

*

* Before calling this method, application must firstly confirm that HUAWEI AR Engine is installed

* and compatiable on current device. Otherwise, exceptions may throwed.

* else

附件

最后附上两个版本的Huawei Engine SDK


发布者:admin,转转请注明出处:http://www.yc00.com/num/1701247842a1063822.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信