Initialization of ARWorldTrackingConfiguration using stored world map

I am trying to init the ARWorldTrackingConfiguration (using myConfiguration.initialWorldMap = worldMapFromFile, in viewWillDissappear) with a world map that I stored from the previous time I ran my app (saving the result from getCurrentWorldMapWithCompletionHandler), but do not understand what to expect. I have a simple scene that I thought would appear on the same place every time I open the app, but the placement is different every time, depending on where the camera points when I open the app.


What I am trying to achieve is to place a 3d-scene correct in relation to a real world position, so that every time the user is pointing the camera with my app in a similar direction from a sensible viewpoint, the model appears in the correct place.


Can anyone give me a high-level explanation on how this is supposed to work?


Best regards

Dag Magne

Replies

Hello,


This sample code shows exactly how to use ARWorldMaps to create persistent ar experiences!

https://developer.apple.com/documentation/arkit/creating_a_persistent_ar_experience