在Unity中暂停Google ARCore [英] Pause Google ARCore in Unity

查看:146
本文介绍了在Unity中暂停Google ARCore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以暂停或至少停止ARCore旋转屏幕.我有一个菜单,可以通过销毁游戏对象并实例化它来在AR场景之间切换",但是当我重新激活菜单时,SessionComponent继续控制摄像头,因为它仍在跟踪剩余的锚点.我不知道如何删除锚,因为它是通过调用Session.CreateAnchor创建的,而Session似乎没有删除锚的方法.我假设删除锚点可能是阻止ARCore跟踪的最佳方法,并且类似于重置它,但是我无法找到如何删除锚点的方法.我实际上尝试删除了Anchor,但是它似乎仍保留在列表中,或者似乎仍然有某些东西试图在Session和Anchor类中跟踪它,从而导致nullptr异常.

Is there any way to pause, or at least stop ARCore from rotating the screen. I have a menu that I use to "switch" between AR scenes by destroying the gameobject and instantiating it, but when I reactivate the menu the SessionComponent continues to control the camera because it is still tracking the leftover anchor. I have no idea how to delete the anchor because of the fact that it is created by calling Session.CreateAnchor and Session doesn't seem to have a method for removing anchors. I'm assuming that removing the anchor could be the best way to stop ARCore from tracking and would be similar to resetting it, but I can't find out how to remove the Anchor. I tried actually deleting the Anchor, but it seems to be still kept in a list or there seems to be something that still attempt to track it in the Session and Anchor class that causes a nullptr exception.

推荐答案

使用ARCoreSession.Destroy(yourAnchor),如果不起作用,请使用ARCoreSession.DestroyImmediate(yourAnchor).

Use ARCoreSession.Destroy(yourAnchor), if this doesn't work use ARCoreSession.DestroyImmediate(yourAnchor).

它在官方文档中仍然没有更新.但是,这就是您实现它的方式

It is still not updated in the official documentation. But, this is how you achieve it

干杯!

这篇关于在Unity中暂停Google ARCore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆