billybob2
billybob2

Reputation: 701

Cannot create anchors while the camera is not tracking

When leaving the ARFragment, and attemping to then resume it.. I guess this issue:

AR_ERROR_NOT_TRACKING: Cannot create anchors while the camera is not tracking.

at first I was getting issues about the scene being paused, I was able to get past that error by calling:

arFragment.getArSceneView().getSession().resume();

However, the camera is not in tracking state apparently. Is there a way to restart that process? I did quite a bit of looking through the docs but couldn't find any sort of method to properly resume camera tracking

Upvotes: 3

Views: 897

Answers (1)

Andy Jazz
Andy Jazz

Reputation: 58063

In ARCore NDK you'd use the following method for destroying a session and releasing its resources:

void ArSession_destroy(ArSession *session);

This method releases resources used by an ARCore session. It'll take several seconds to complete. To prevent blocking the main thread, call ArSession_pause() on the main thread, and then call ArSession_destroy() on a background thread.

Then, you have to create a new session with :

ArSession_create();

Also, in ARCore Android, there's typically onPause() and onResume() methods for current session. But I use 2 other ones: pause() for pausing the current session and resume() for starting or resuming the ARCore current session.

Read about ArSession methods HERE.

Hope this helps.

Upvotes: 1

Related Questions