I need to reset
/restart
the ARCore session. In ARKit, I just have to create a new configuration and execute the RunWithConfigAndOptions
method, but I can't find any information on how to do this in ARCore. The following is the code I use in 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);
I'm working in Unity, but I guess any information will be useful.
Thanks
Try DestroyImmediate(session)
or Destroy(session)
. One of them may work.
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;
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With