如何重置或重启ARCore会话?

Mik*_*ane 5 java unity-game-engine augmented-reality kotlin arcore

我需要reset/ restartARCore会议。在ARKit中,我只需要创建一个新配置并执行该RunWithConfigAndOptions方法,但是在ARCore中找不到有关如何执行此操作的任何信息。以下是我在Unity for ARKit中使用的代码:

ARKitWorldTrackingSessionConfiguration config = new ARKitWorldTrackingSessionConfiguration();
config.planeDetection = UnityARPlaneDetection.Horizontal;
config.alignment = UnityARAlignment.UnityARAlignmentGravity;
config.enableLightEstimation = true;  

UnityARSessionNativeInterface.GetARSessionNativeInterface().RunWithConfigAndOptions(config, 
                                                                                    UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | 
                                                                                    UnityARSessionRunOption.ARSessionRunOptionResetTracking);
Run Code Online (Sandbox Code Playgroud)

我在Unity中工作,但是我想任何信息都将有用。

谢谢

ARG*_*Geo 3

尝试DestroyImmediate(session)Destroy(session)。其中之一可能有效。

ARCoreSession session = goARCoreDevice.GetComponent<ARCoreSession>();
ARCoreSessionConfig myConfig = session.SessionConfig;

DestroyImmediate(session);
// Destroy(session);

yield return null;

session = goARCoreDevice.AddComponent<ARCoreSession>();
session.SessionConfig = myConfig;
session.enabled = true;
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助。